#include<bits/stdc++.h>
#define x first
#define y second
#define PB push_back
#define mst(x,a) memset(x,a,sizeof(x))
#define all(a) begin(a),end(a)
#define rep(x,l,u) for(ll x=l;x<u;x++)
#define rrep(x,l,u) for(ll x=l;x>=u;x--)
#define IOS ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<long,long> PLL;
typedef pair<char,char> PCC;
typedef long long ll;
const int N=1005;
const int M=1e6+10;
const int INF=0x3f3f3f3f;
const int MOD=1e9+7;
void solve(){
int n,k;cin>>n>>k;
if(!k){
cout<<n<<endl;
rep(i,1,n+1) cout<<i<<' ';
cout<<endl;
return;
}
if(n<=2*k+1){
cout<<1<<endl;
cout<<n/2+1<<endl;
return;
}
if(n%(2*k+1)==0){
cout<<n/(2*k+1)<<endl;
for(int i=k+1;i<=n;i+=(2*k+1)) cout<<i<<' ';
cout<<endl;
return;
}
cout<<n/(2*k+1)+1<<endl;
for(int i=1+(n%(2*k+1))/2;i<=n;i+=(2*k+1)) cout<<i<<' ';
cout<<endl;
}
int main(){
IOS;
solve();
return 0;
}