#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  if (k == 0) {
    cout << n << endl;
    for (int i = 1; i <= n; i++) {
      cout << i;
      if (i < n) cout << " ";
    }
    cout << endl;
    return 0;
  }
  vector<int> ans;
  for (int j = 0; j <= k; j++) {
    int check = 0;
    int counter = j;
    for (int i = 0; i < n; i++) {
      counter++;
      if (counter == k + 1) {
        check = 1;
        ans.push_back(i + 1);
      } else if (counter == (k * 2) + 1) {
        counter = 0;
        check = 0;
      }
    }
    if (check == 0 && counter > 0 && ans.size() == 0) {
      ans.push_back(n);
      break;
    } else if (check || (check == 0 && counter == 0)) {
      break;
    } else {
      ans.clear();
    }
  }
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i];
    if (i < ans.size() - 1) cout << " ";
  }
  cout << endl;
}
