#include <bits/stdc++.h>
using namespace std;

ifstream f("pagenumber.inp");
ofstream g("pagenumber.out");

string s;
int a[1000];

int main()
{
    cin>>s;
    string tmp="";
    int vt=0;
    int k=0;
    while (vt!=string::npos){
        vt=s.find(',');
        if(vt==string::npos){
            tmp=s.substr(0);
            s.clear();
        }
        else {
            for (int j=0; j<vt; j++)
                tmp+=s[j];
            s.erase(0,tmp.size()+1);
        }
            int x=atoi(tmp.c_str());
            k=max(k,x);
            if (!a[x]) a[x]=1;
            tmp.clear();
    }
    for (int i=0; i<=k; i++)
        if (a[i]){
        int l=i;
    while (a[i]) i++;
    i--;
    int r=i;
    cout<<l;
    if (r-l>0) cout<<'-'<<r;
    if (i<k) cout<<',';
        }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;
ifstream fi ("pagenumber.inp");
ofstream fo ("pagenumber.out");
int a[1005]={0}, start=0;
string s,s1;

int doi(string x) {
    int c=1,ans=0;
    for (int i=x.size()-1; i>=0; i--) {
        ans+=c*(x[i]-48);
        c*=10;
    }
    return ans;
}

int main()
{
    getline(cin,s);
    int vt,x;
    while (!s.empty()) {
        vt=s.find(',');
        if (vt==-1) {
            vt=s.size();
            s1=s.substr(0,vt);
            s.erase(0,1);
        }
        else {
            s1=s.substr(0,vt);
            s.erase(0,vt+1);
        }
        x=doi(s1);
        a[x]++;
    }
    for (int i=0; i<=1000; i++) {
        if (a[i]!=0 && start==0) start=i;
        if (a[i]==0 && start!=0) {
            if (start==i-1) cout<<start;
            else cout<<start<<'-'<<i-1;
            vt=i;
            start=0;
            break;
        }
    }
    for (int i=vt; i<=1000; i++) {
        if (a[i] && start==0) start=i;
        if (a[i]==0)
            if (start!=0) {
                if (start!=i-1) cout<<','<<start<<'-'<<i-1;
                else cout<<','<<start;
                start=0;
            }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
ifstream fi ("pagenumber.inp");
ofstream fo ("pagenumber.out");
int a[1005]={0}, start=0,gtmax=0;
string s,s1;

int doi(string x) {
    int c=1,ans=0;
    for (int i=x.size()-1; i>=0; i--) {
        ans+=c*(x[i]-48);
        c*=10;
    }
    return ans;
}

int main()
{
    getline(cin,s);
    int vt,x;
    while (!s.empty()) {
        vt=s.find(',');
        if (vt==-1) {
            vt=s.size();
            s1=s.substr(0,vt);
            s.erase(0,vt);
        }
        else {
            s1=s.substr(0,vt);
            s.erase(0,vt+1);
        }
        x=doi(s1);
        a[x]++;
        if (x>gtmax) gtmax=x;
    }
    for (int i=1; i<=gtmax+1; i++) {
        if (a[i]!=0 && start==0) start=i;
        if (a[i]==0 && start!=0) {
            if (start==i-1) fo<<start;
            else cout<<start<<'-'<<i-1;
            vt=i;
            start=0;
            break;
        }
    }
    for (int i=vt; i<=gtmax+1; i++) {
        if (a[i] && start==0) start=i;
        if (a[i]==0)
            if (start!=0) {
                if (start!=i-1) cout<<','<<start<<'-'<<i-1;
                else cout<<','<<start;
                start=0;
            }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
ifstream fi ("pagenumber.inp");
ofstream fo ("pagenumber.out");
int a[1005]={0}, start=-1,gtmax=0;
string s,s1;

int doi(string x) {
    int c=1,ans=0;
    for (int i=x.size()-1; i>=0; i--) {
        ans+=c*(x[i]-48);
        c*=10;
    }
    return ans;
}

int main()
{
    getline(cin,s);
    int vt,x;
    while (!s.empty()) {
        vt=s.find(',');
        if (vt==-1) {
            vt=s.size();
            s1=s.substr(0,vt);
            s.erase(0,vt);
        }
        else {
            s1=s.substr(0,vt);
            s.erase(0,vt+1);
        }
        x=doi(s1);
        a[x]++;
        if (x>gtmax) gtmax=x;
    }
    for (int i=0; i<=gtmax+1; i++) {
        if (a[i]!=0 && start==-1) start=i;
        if (a[i]==0 && start!=-1) {
            if (start==i-1) cout<<start;
            else cout<<start<<'-'<<i-1;
            vt=i;
            start=-1;
            break;
        }
    }
    for (int i=vt; i<=gtmax+1; i++) {
        if (a[i] && start==-1) start=i;
        if (a[i]==0)
            if (start!=-1) {
                if (start!=i-1) cout<<','<<start<<'-'<<i-1;
                else cout<<','<<start;
                start=-1;
            }
    }
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn=3000;
int b[maxn];
char a[maxn];
int main()
{
    int u=0;
    scanf("%s",a);
    int len=strlen(a);
    int flagg=0;
    for(int i=0;i<len;i++)
    {
        int ss=0;
        while(a[i]!=','&&a[i]!='\0')
        {
            flagg=1;
            ss=ss*10+a[i]-'0';
            i++;
        }
        if(flagg)
        {b[u++]=ss;flagg=0;}
    }
    u--;
    sort(b,b+u+1);
    for(int i=0;i<=u-1;i++)
    {
        while(b[i]==b[i+1])
        {
            b[i]=-1;
            i++;
        }
    }
    sort(b,b+u+1);
    int flag=0;
    //for(int i=0;i<=u;i++)
    //cout<<b[i]<<" ";
    //cout<<endl;
    for(int i=0;i<=u;i++)
    {
        while(b[i]<0)
        i++;
        cout<<b[i];
        int c=0;
        while(b[i+1]==b[i]+1)
        {
            flag=1;
            i++;
            c=b[i];
           // cout<<c;
        }
        if(flag)
        {cout<<"-"<<c;flag=0;}
        if(i<u)
        cout<<",";
    }
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn=300;
int b[maxn];
char a[maxn];
int main()
{
    int u=0;
    scanf("%s",a);
    int len=strlen(a);
    int flagg=0;
    for(int i=0;i<len;i++)
    {
        int ss=0;
        while(a[i]!=','&&a[i]!='\0')
        {
            flagg=1;
            ss=ss*10+a[i]-'0';
            i++;
        }
        if(flagg)
        {b[u++]=ss;flagg=0;}
    }
    u--;
    sort(b,b+u+1);
    for(int i=0;i<=u-1;i++)
    {
        while(b[i]==b[i+1])
        {
            b[i]=-1;
            i++;
        }
    }
    sort(b,b+u+1);
    int flag=0;
    //for(int i=0;i<=u;i++)
    //cout<<b[i];
    //cout<<endl;
    for(int i=0;i<=u;i++)
    {
        while(b[i]<0)
        i++;
        cout<<b[i];
        int c=0;
        while(b[i+1]==b[i]+1)
        {
            flag=1;
            i++;
            c=b[i];
           // cout<<c;
        }
        if(flag)
        {cout<<"-"<<c;flag=0;}
        if(i<u)
        cout<<",";
    }
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn=300;
int b[maxn];
char a[maxn];
int main()
{
    int u=0;
    scanf("%s",a);
    int len=strlen(a);
    int flagg=0;
    for(int i=0;i<len;i++)
    {
        int ss=0;
        while(a[i]!=','&&a[i]!='\0')
        {
            flagg=1;
            ss=ss*10+a[i]-'0';
            i++;
        }
        if(flagg)
        {b[u++]=ss;flagg=0;}
    }
    u--;
    sort(b,b+u+1);
    for(int i=0;i<=u-1;i++)
    {
        while(b[i]==b[i+1])
        {
            b[i]=-1;
            i++;
        }
    }
    sort(b,b+u+1);
    int flag=0;
    for(int i=0;i<=u;i++)
    cout<<b[i];
    cout<<endl;
    for(int i=0;i<=u;i++)
    {
        while(b[i]<0)
        i++;
        cout<<b[i];
        int c=0;
        while(b[i+1]==b[i]+1)
        {
            flag=1;
            i++;
            c=b[i];
           // cout<<c;
        }
        if(flag)
        {cout<<"-"<<c;flag=0;}
        if(i<u)
        cout<<",";
    }
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn=3000;
int b[maxn];
char a[maxn];
int main()
{
    int u=0;
    scanf("%s",a);
    int len=strlen(a);
    int flagg=0;
    for(int i=0;i<len;i++)
    {
        int ss=0;
        while(a[i]!=','&&a[i]!='\0')
        {
            flagg=1;
            ss=ss*10+a[i]-'0';
            i++;
        }
        if(flagg)
        {b[u++]=ss;flagg=0;}
    }
    u--;
    sort(b,b+u+1);
    for(int i=0;i<=u-1;i++)
    {
        while(b[i]==b[i+1])
        {
            b[i]=-1;
            i++;
        }
    }
    sort(b,b+u+1);
    int flag=0;
    for(int i=0;i<=u;i++)
    cout<<b[i]<<" ";
    cout<<endl;
    for(int i=0;i<=u;i++)
    {
        while(b[i]<0)
        i++;
        cout<<b[i];
        int c=0;
        while(b[i+1]==b[i]+1)
        {
            flag=1;
            i++;
            c=b[i];
           // cout<<c;
        }
        if(flag)
        {cout<<"-"<<c;flag=0;}
        if(i<u)
        cout<<",";
    }
}


#include<bits/stdc++.h>

using namespace std;
//Page Numbers
int a[1010];
bool b[1010];
int main()
{
    bool H=false;
    int st,en,n=0,num=0,x=0;
    string s;
    cin>>s;
    s += ',';
    for(int i=0;i<s.length();++i)
    {
        if(s[i]==',')
        {
            a[n]=num;
            num=0;
            ++n;
        }
        else
        {
            num*=10;
            num+=s[i]-'0';
        }
    }
    /*
    sort(a,a+n);
    st=a[0];
    for(int i=1;i<n;++i)
        if(a[i]-a[i-1]>1)
*/
    for(int i=n-1;i>=0;--i)
    {
        b[a[i]]=true;
    }
    for(int i=10000;i>=0;--i)
        if(b[i])
            x=i;

    st=x;
    for(int i=x;i<1005;++i)
    {
        if(b[i]==false)
        {
            en=i-1;
            if(st!=en)
            {
                if (H)
                    cout<<",";
                cout<<(st)<<'-'<<(en);
                H=true;
            }

            else
            {
                if (H) cout<<",";
                cout<<(st);
                H=true;
            }

            while(b[i]==false)i++;
            st=i;
        }
        /*
        for(int z=0;z<S.length()-1;++z)
            cout<<S[z];*/

    }
    return 0;
}


#include<bits/stdc++.h>

using namespace std;
//Page Numbers
int a[1010];
bool b[1010];
int main()
{
    bool H=false,h=false;
    int st,en,n=0,num=0,x=0;
    string s;
    cin>>s;
    s += ',';
    for(int i=0;i<s.length();++i)
    {
        if(s[i]==',')
        {
            a[n]=num;
            num=0;
            ++n;
        }
        else
        {
            num*=10;
            num+=s[i]-'0';
        }
    }
    /*
    sort(a,a+n);
    st=a[0];
    for(int i=1;i<n;++i)
        if(a[i]-a[i-1]>1)
*/
    for(int i=n-1;i>=0;--i)
    {
        b[a[i]]=true;
        x=a[i];
    }
    st=x;
    for(int i=x;i<1005;++i)
    {
        if(b[i]==false)
        {
            en=i-1;
            if(st!=en)
            {
                if (H)
                    cout<<",";
                cout<<(st)<<'-'<<(en);
                H=true;
            }

            else
            {
                if (h) cout<<",";
                cout<<(st);
                h=true;
            }

            while(b[i]==false)i++;
            st=i;
        }
        /*
        for(int z=0;z<S.length()-1;++z)
            cout<<S[z];*/

    }
    return 0;
}


#include<bits/stdc++.h>

using namespace std;
//Page Numbers
int a[1010];
bool b[1010];
int main()
{
    bool H=false;
    int st,en,n=0,num=0,x=0;
    string s;
    cin>>s;
    s += ',';
    for(int i=0;i<s.length();++i)
    {
        if(s[i]==',')
        {
            a[n]=num;
            num=0;
            ++n;
        }
        else
        {
            num*=10;
            num+=s[i]-'0';
        }
    }
    /*
    sort(a,a+n);
    st=a[0];
    for(int i=1;i<n;++i)
        if(a[i]-a[i-1]>1)
*/
    for(int i=n-1;i>=0;--i)
    {
        b[a[i]]=true;
        x=a[i];
    }
    st=x;
    for(int i=x;i<1005;++i)
    {
        if(b[i]==false)
        {
            en=i-1;
            if(st!=en)
            {
                if (H)
                    cout<<",";
                cout<<(st)<<'-'<<(en);
                H=true;
            }

            else
            {
                if (H) cout<<",";
                cout<<(st);
                H=true;
            }

            while(b[i]==false)i++;
            st=i;
        }
        /*
        for(int z=0;z<S.length()-1;++z)
            cout<<S[z];*/

    }
    return 0;
}


#include<bits/stdc++.h>

using namespace std;
//Page Numbers
int a[1010];
bool b[1010];
int main()
{
    bool H=false;
    int st,en,n=0,num=0,x=0;
    string s,S="";
    cin>>s;
    s += ',';
    for(int i=0;i<s.length();++i)
    {
        if(s[i]==',')
        {
            a[n]=num;
            num=0;
            ++n;
        }
        else
        {
            num*=10;
            num+=s[i]-'0';
        }
    }
    /*
    sort(a,a+n);
    st=a[0];
    for(int i=1;i<n;++i)
        if(a[i]-a[i-1]>1)
*/
    for(int i=0;i<n;++i)
        b[a[i]]=true;

    for(int i=0;i<n;++i)
        if(b[i]==true)
        {
            x=i;
            break;
        }
    st=x;
    for(int i=x;i<1005;++i)
    {
        if(b[i]==false)
        {
            en=i-1;
            if(st!=en)
            {
                if (H==true)
                    cout<<",";
                cout<<(st)<<'-'<<(en);
                H=true;
            }

            else
            {
                if (H==true) cout<<",";
                cout<<(st);
                H=true;
            }

            while(b[i]==false)i++;
            st=i;
        }
        /*
        for(int z=0;z<S.length()-1;++z)
            cout<<S[z];*/

    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <sstream>
using namespace std;
int num[100];
int main() {
    int n = 0;
    while(cin >> num[n++]) {
        getchar();
    }
    n--;
    sort(num, num + n);
    bool sat = false;
    for(int i = 0; i < n - 1; i++) {
        if(num[i + 1] - num[i] <= 1 && !sat) {
            cout << num[i];
            sat = true;
        }
        else if(num[i + 1] - num[i] > 1 && sat) {
            if(num[i] != num[i - 1])
                cout << "-" << num[i] << (i < n - 1 ? "," : "");
            else
                cout << ",";
            sat = false;
        }
        else if(num[i + 1] - num[i] > 1 && !sat) {
            cout << num[i] << (i < n - 1 ? "," : "");
        }
    }
    if(num[n - 1] - num[n - 2] > 1) {
        cout << num[n - 1];
    }
    else if(num[n - 1] - num[n - 2] == 1)
        cout << "-" << num[n - 1];
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <sstream>
using namespace std;
int num[100];
int main() {
    int n = 0;
    while(cin >> num[n++]) {
        getchar();
    }
    n--;
    cout << endl;
    sort(num, num + n);
    string filtering_1, filtering_2;
    bool sat = false;
    for(int i = 0; i < n; i++) {
        stringstream ss;
        if(num[i] == num[i + 1] && !sat && i + 1 < n) {
            ss << num[i];
            filtering_1 += ss.str();
            sat = true;
        }
        else if(num[i] != num[i + 1] && sat && i + 1 < n) {
            ss <<num[++i];
            sat = false;
            filtering_1 += "-" + ss.str() + (i < n - 1 ? "," : "");
        }
        else if(num[i] != num[i + 1] && !sat) {
            ss << num[i];
            filtering_1 += ss.str() + (i < n - 1 ? "," : "");
        }
    }
    for(int i = 0; i < filtering_1.size(); i++) {
        if(filtering_1[i] == '-' && filtering_1[i + 4] == '-') {
            filtering_2 += "-";
            filtering_2 += filtering_1[i + 5];
            i += 5;
        }
        else
            filtering_2 += filtering_1[i];
    }
    cout << filtering_1 << endl;
    cout << filtering_2 << endl;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <sstream>
using namespace std;
int num[100];
int main() {
    int n = 0;
    while(cin >> num[n++]) {
        getchar();
    }
    n--;
    sort(num, num + n);
    bool sat = false;
    for(int i = 0; i < n - 1; i++) {
        if(num[i + 1] - num[i] <= 1 && !sat) {
            cout << num[i];
            sat = true;
        }
        else if(num[i + 1] - num[i] > 1 && sat) {
            cout << "-" << num[i] << (i < n - 1 ? "," : "");
            sat = false;
        }
        else if(num[i + 1] - num[i] > 1 && !sat) {
            cout << num[i] << (i < n - 1 ? "," : "");
        }
    }
    cout << (num[n - 1] - num[n - 2] <= 1 ? "-" : "") <<num[n - 1];
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <sstream>
using namespace std;
int num[100];
int main() {
    int n = 0;
    while(cin >> num[n++]) {
        getchar();
    }
    n--;
    sort(num, num + n);
    bool sat = false;
    for(int i = 0; i < n - 1; i++) {
        if(num[i + 1] - num[i] <= 1 && !sat) {
            cout << num[i];
            sat = true;
        }
        else if(num[i + 1] - num[i] > 1 && sat) {
            if(num[i] != num[i - 1])
                cout << "-" << num[i] << (i < n - 1 ? "," : "");
            else
                cout << ",";
            sat = false;
        }
        else if(num[i + 1] - num[i] > 1 && !sat) {
            cout << num[i] << (i < n - 1 ? "," : "");
        }
    }
    if(num[n - 1] - num[n - 2] > 1) {
        cout << num[n - 1];
    }
    else if(num[n - 1] - num[n - 2] == 1) {
        cout << "-" << num[n - 1];
    }
    else {
        int t = n - 1;
        while(--t) {
            if(num[n - 1] - num[t] == 1) {
                cout << "-" << num[n - 1];
                break;
            }
            else if(num[n - 1] - num[t] > 1) {
                cout << "," << num[n - 1];
                break;
            }
        }
    }
}


#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int num[100];
int main() {
    int n = 0;
    while(cin >> num[n++]) {
        getchar();
    }
    n--;
    sort(num, num + n);
    bool sat = false;
    for(int i = 0; i < n - 1; i++) {
        if(num[i + 1] - num[i] <= 1 && !sat) {
            cout << num[i];
            sat = true;
        }
        else if(num[i + 1] - num[i] > 1 && sat) {
            if(num[i] != num[i - 1])
                cout << "-" << num[i] << (i < n - 1 ? "," : "");
            else
                cout << ",";
            sat = false;
        }
        else if(num[i + 1] - num[i] > 1 && !sat) {
            cout << num[i] << (i < n - 1 ? "," : "");
        }
    }
    if(num[n - 1] - num[n - 2] > 1) {
        cout << num[n - 1];
    }
    else if(num[n - 1] - num[n - 2] == 1) {
        cout << "-" << num[n - 1];
    }
    else {
        int t = n - 1;
        while(--t) {
            if(num[n - 1] - num[t] == 1) {
                cout << "-" << num[n - 1];
                break;
            }
        }
    }
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <sstream>
using namespace std;
int num[100];
int main() {
    int n = 0;
    while(cin >> num[n++]) {
        getchar();
    }
    n--;
    if(n == 1) {
        cout << num[0];
        return 0;
    }
    sort(num, num + n);
    /*
        for(int i = 0; i < n; i++)
            cout << num[i] << " ";
        cout << endl;
    */
    bool sat = false, spec = false;
    for(int i = 0; i < n - 1; i++) {
        if(num[i + 1] - num[i] <= 1 && !sat) {
            cout << num[i];
            sat = true;
        }
        else if(num[i + 1] - num[i] > 1 && sat) {
            if(num[i] - num[i - 1] == 1 && !spec)
                cout << "-" << num[i] << (i < n - 1 ? "," : "");
            else if(num[i + 1] - num[i] > 1 && spec)
                cout << "-" << num[i] << (i < n - 1 ? "," : "");
            else
                cout << ",";
            sat = false;
            spec = false;
        }
        else if(num[i + 1] - num[i] > 1 && !sat) {
            cout << num[i] << (i < n - 1 ? "," : "");
        }
        if(sat && num[i] - num[i - 1] == 1) {
            spec = true;
        }
    }
    if(num[n - 1] - num[n - 2] > 1) {
        cout << num[n - 1];
    }
    else if(num[n - 1] - num[n - 2] == 1) {
        cout << "-" << num[n - 1];
    }
    else {
        int t = n - 1;
        while(--t) {
            if(num[n - 1] - num[t] == 1) {
                cout << "-" << num[n - 1];
                break;
            }
        }
    }
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <sstream>
using namespace std;
int num[100];
int main() {
    int n = 0;
    while(cin >> num[n++]) {
        getchar();
    }
    n--;
    sort(num, num + n);
    bool sat = false;
    for(int i = 0; i < n - 1; i++) {
        if(num[i + 1] - num[i] <= 1 && !sat) {
            cout << num[i];
            sat = true;
        }
        else if(num[i + 1] - num[i] > 1 && sat) {
            cout << "-" << num[i] << (i < n - 1 ? "," : "");
            sat = false;
        }
        else if(num[i + 1] - num[i] > 1 && !sat) {
            cout << num[i] << (i < n - 1 ? "," : "");
        }
    }
    if(num[n - 1] - num[n - 2] > 1) {
        cout << num[n - 1];
    }
    else if(num[n - 1] - num[n - 2] == 1)
        cout << "-" << num[n - 1];
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <sstream>
using namespace std;
int num[100];
int main() {
    int n = 0;
    while(cin >> num[n++]) {
        getchar();
    }
    n--;
    cout << endl;
    sort(num, num + n);
    string filtering_1, filtering_2;
    bool sat = false;
    for(int i = 0; i < n; i++) {
        stringstream ss;
        if(num[i] == num[i + 1] && !sat && i + 1 < n) {
            ss << num[i];
            filtering_1 += ss.str();
            sat = true;
        }
        else if(num[i] != num[i + 1] && sat && i + 1 < n) {
            ss <<num[++i];
            sat = false;
            filtering_1 += "-" + ss.str() + (i < n - 1 ? "," : "");
        }
        else if(num[i] != num[i + 1] && !sat) {
            ss << num[i];
            filtering_1 += ss.str() + (i < n - 1 ? "," : "");
        }
    }
    for(int i = 0; i < filtering_1.size(); i++) {
        if(filtering_1[i] == '-' && filtering_1[i + 4] == '-') {
            filtering_2 += "-";
            filtering_2 += filtering_1[i + 5];
            i += 5;
        }
        else
            filtering_2 += filtering_1[i];
    }
    cout << filtering_2 << endl;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <sstream>
using namespace std;
int num[100];
int main() {
    int n = 0;
    while(cin >> num[n++]) {
        getchar();
    }
    n--;
    sort(num, num + n);
    /*
        for(int i = 0; i < n; i++)
            cout << num[i] << " ";
        cout << endl;
    */
    bool sat = false, spec = false;
    for(int i = 0; i < n - 1; i++) {
        if(num[i + 1] - num[i] <= 1 && !sat) {
            cout << num[i];
            sat = true;
        }
        else if(num[i + 1] - num[i] > 1 && sat) {
            if(num[i] - num[i - 1] == 1 && !spec)
                cout << "-" << num[i] << (i < n - 1 ? "," : "");
            else if(num[i + 1] - num[i] > 1 && spec)
                cout << "-" << num[i] << (i < n - 1 ? "," : "");
            else
                cout << ",";
            sat = false;
            spec = false;
        }
        else if(num[i + 1] - num[i] > 1 && !sat) {
            cout << num[i] << (i < n - 1 ? "," : "");
        }
        if(sat && num[i] - num[i - 1] == 1) {
            spec = true;
        }
    }
    if(num[n - 1] - num[n - 2] > 1) {
        cout << num[n - 1];
    }
    else if(num[n - 1] - num[n - 2] == 1) {
        cout << "-" << num[n - 1];
    }
    else {
        int t = n - 1;
        while(--t) {
            if(num[n - 1] - num[t] == 1) {
                cout << "-" << num[n - 1];
                break;
            }
        }
    }
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <sstream>
using namespace std;
int num[100];
int main() {
    int n = 0;
    while(cin >> num[n++]) {
        getchar();
    }
    n--;
    sort(num, num + n);
    string filtering_1, filtering_2;
    bool sat = false;
    for(int i = 0; i < n; i++) {
        stringstream ss;
        if(num[i + 1] - num[i] <= 1 && !sat && i + 1 < n) {
            ss << num[i];
            filtering_1 += ss.str();
            sat = true;
        }
        else if(num[i] != num[i + 1] && sat && i + 1 < n) {
            ss <<num[i];
            sat = false;
            filtering_1 += "-" + ss.str() + (i < n - 1 ? "," : "");
        }
        else if(num[i] != num[i + 1] && !sat) {
            ss << num[i];
            filtering_1 += ss.str() + (i < n - 1 ? "," : "");
        }
    }
    for(int i = 0; i < filtering_1.size(); i++) {
        if(filtering_1[i] == '-' && filtering_1[i + 4] == '-') {
            filtering_2 += "-";
            filtering_2 += filtering_1[i + 5];
            i += 5;
        }
        else
            filtering_2 += filtering_1[i];
    }
    cout << filtering_2;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <set>
using namespace std;
int main()
{
    char c;
    bool flag = true;
    while (flag)
    {
        priority_queue<int, vector<int>, greater<int> > q;
        int t = 0;
        while ((c = cin.get()) != '\n')
        {
            if (c == EOF)
            {
                flag = false;
                break;
            }
            if (isdigit(c)) t = t * 10 + c - '0';
            if (c == ',')
            {
                q.push(t);
                t = 0;
            }
        }
        q.push(t);
        if (!flag) break;
        t = -1;
        int c = 0;
        while (!q.empty())
        {
            if (t == -1)
            {
                t = q.top();
                q.pop();
                c++;
                cout << t;
            }
            else
            {
                if (q.top() == t || q.top() == t + 1)
                {
                    if (q.top() == t + 1)
                    {
                        ++c;
                        ++t;
                    }
                    q.pop();
                }
                else
                {
                    if (c > 1)
                    {
                        cout << "-" << t;
                    }
                    t = q.top();
                    q.pop();
                    cout << ',' << t;
                    c = 1;
                }
            }
        }
        if (c > 1)
        {
            cout << "-" << t;
        }
        cout << endl;
    }
    return 0;
}


#include <iostream>
#include <cstdio>

using namespace std;

int page[1010];
int maxn;
int main()
{
    maxn=-1;
    int n;
    while(~scanf("%d",&n)){
        if(n>maxn)maxn=n;
        page[n]++;
        getchar();
    }
    for(int i=1;i<=maxn;i++){
        if(page[i])
        {
            cout<<i;
            int j;
            for(j=i+1;j<=maxn&&page[j];j++);
            if(j-1!=i)
                cout<<'-'<<j-1;
            i=j;
            if(i<=maxn) cout<<',';
        }
    }
    cout<<endl;
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <sstream>
#include <cstdio>
using namespace std;

int main()
{
    vector<int> v;
    int t; char c;
    while(scanf("%d",&t))
    {
        v.push_back(t);
        scanf("%c",&c);
        if(c=='\n')
            break;
    }
    vector< pair<int,int> > ans;
    sort(v.begin(),v.end());
    v.erase( unique(v.begin(),v.end()),v.end() );
    int l=v[0],r=0;
    //for(int i=0;i<v.size();i++) cout<<v[i]<<" ";
    //cout<<endl;
    int flag=false;
    for(int i=0;i<v.size()-1;i++){
        if(v[i+1]!=v[i]+1){
            r=v[i];
            ans.push_back(make_pair(l,r));
            l=v[i+1];
            if(i+1==v.size()-1) ans.push_back(make_pair(l,l));
            flag=true;
        }
    }
    if(flag==false) ans.push_back(make_pair(l,v[v.size()-1]));
    for(int i=0;i<ans.size();i++){
        if(ans[i].first==ans[i].second) cout<<ans[i].first;
        else cout<<ans[i].first<<"-"<<ans[i].second;
        if(i!=ans.size()-1) cout<<",";
    }
    return 0;
}


#include <iostream>
#include <stdio.h>

using namespace std;

int main()
{
    int p[100];
    int i=0;
    int tmp;
    char c;
    while(cin>>p[i]){
        i++;
        c=getchar();
        if (c=='\n') break;
    }
    for (int j=0;j<i-1;j++){
        for (int k=j+1;k<i;k++){
            if (p[j]>p[k]){
                tmp=p[k];
                p[k]=p[j];
                p[j]=tmp;
            }
        }
    }
    /*for (int j=0;j<i;j++){
        cout <<p[j]<<' ';
    }
    cout<<endl;*/
    int j=0,k=1;
    while(k<i){
        if (p[k]>=p[k-1]+2) {
            //cout << k<< ' '<<j<<endl;
            if (j==k-1) cout<<p[j]<<',';
            else cout<<p[j]<<'-'<<p[k-1]<<',';
            j=k;
        }
        //cout<< k<<endl;
        k++;
    }
    if (p[j]==p[i-1])cout<<p[j];
    else cout<<p[j]<<'-'<<p[i-1];
    return 0;
}


#include <iostream>
#include <algorithm>
#include <sstream>

using namespace std;

int main()
{
    int i,num,flag,temp,page[1001];
    string s;
    while(cin >> s)
    {
        num = 0;
        flag = 0;
        for(i = 0;i < s.length();i++)
        {
            if(s[i] == ',')
                s[i] = ' ';
        }
        stringstream ss;
        ss << s;
        while(ss >> temp)
            page[num++] = temp;
        sort(page,page + num);
        cout << page[0];
        for(i = 1;i < num;i++)
        {
            if(page[i] == page[i - 1] + 1)
            {
                if(flag == 0)
                {
                    cout << '-';
                    flag = 1;
                }
            }
            if(page[i] > page[i - 1] + 1)
            {
                if(flag)
                {
                    cout << page[i - 1] << ',' << page[i];
                    flag = 0;
                }
                else
                    cout << ',' << page[i];
            }
        }
        if(flag)
            cout << page[num - 1];
        cout << endl;
    }
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
   char page[1000],mem[100][5];
   int i,j,k,pages[100],temp,a,b,judge;
   while(scanf("%s",page)!=EOF)
   {
       j=0;k=0;judge=0;
       for(i=0;i<strlen(page);i++)
       {
           if(page[i]!=',')
            mem[j][k++]=page[i];
            else {j++;k=0;}
       }
       for(i=0;i<=j;i++)
        pages[i]=strtol(mem[i],NULL,10);
        pages[j+1]=1000;
       for(i=0;i<=j+1;i++)
       {
           for(k=i+1;k<=j+1;k++)
           {
               if(pages[i]>pages[k])
               {
                   temp=pages[i];
                   pages[i]=pages[k];
                   pages[k]=temp;
               }
           }
       }
       k=-1;
       for(i=k+1;i<=j;i++)
       {
           a=pages[i];
          for(;i<=j;i++)
          {
              if(pages[i+1]-pages[i]>=2)
              {
                  b=pages[i];
                  if(b==a&&judge!=0){printf(",%d",b);judge=1;break;}
                  else if(b==a&&judge==0){printf("%d",b);judge=2;break;}
                  else if(b!=a&&judge==0){printf("%d-%d",a,b);judge=2;break;}
                  else if(b!=a&&judge!=0){printf(",%d-%d",a,b);judge=1;break;}
              }
          }
       }
       printf("\n");
         for(i=0;i<100;i++)
       {
        pages[i]=0;page[i]=0;
        for(k=0;k<=5;k++)mem[i][j]=0;
       }
   }
    return 0;
}


#include <iostream>
using namespace std;
#include <stdio.h>
#include <algorithm>
int main()
{
	int T=1,i;
	int Num[110],Last[110];
	scanf("%d",&Num[0]);
	char c;
	while(c=getchar())
	{
		if(c=='\n') break;
		scanf("%d",&Num[T]);
		T++;
	}
	sort(Num,Num+T);
	int P=1;
	Last[0]=Num[0];
	for( i=1;i<T;i++)
	{
		if(Num[i]==Num[i-1]) continue;
		Last[P++]=Num[i];
	}
	bool flag=false;
	bool first=true;
	int start=0,len=1;
	for( i=1;i<P;i++)
	{
		if(i==P-1)
		{
			if(Last[i]!=Last[i-1]+1)
			{
				if(first==false) printf(",");
				else first=false;
				if(len==1) printf("%d",Last[start]);
				else printf("%d-%d",Last[start],Last[i-1]);
				printf(",%d",Last[i]);
				start=i; len=1;
			}
			else printf("%d-%d",Last[start],Last[i]);
			break;
		}
		if(Last[i]!=Last[i-1]+1)
		{
			if(first==false) printf(",");
			else first=false;
			if(len==1) printf("%d",Last[start]);
			else printf("%d-%d",Last[start],Last[i-1]);
			start=i; len=1;
		}
		else len++;
	}
	printf("\n");
	while(1);
}


#include <iostream>
using namespace std;
#include <stdio.h>
#include <algorithm>
int main()
{
	int T=1,i;
	int Num[110],Last[110];
	scanf("%d",&Num[0]);
	char c;
	while(c=getchar())
	{
		if(c=='\n') break;
		scanf("%d",&Num[T]);
		T++;
	}
	sort(Num,Num+T);
	int P=1;
	Last[0]=Num[0];
	for( i=1;i<T;i++)
	{
		if(Num[i]==Num[i-1]) continue;
		Last[P++]=Num[i];
	}
	bool flag=false;
	bool first=true;
	int start=0,len=1;
	for( i=1;i<P;i++)
	{
		if(i==P-1)
		{
			if(Last[i]!=Last[i-1]+1)
			{
				if(first==false) printf(",");
				else first=false;
				if(len==1) printf("%d",Last[start]);
				else printf("%d-%d",Last[start],Last[i-1]);
				printf(",%d",Last[i]);
				start=i; len=1;
			}
			else printf("%d-%d",Last[start],Last[i]);
			break;
		}
		if(Last[i]!=Last[i-1]+1)
		{
			if(first==false) printf(",");
			else first=false;
			if(len==1) printf("%d",Last[start]);
			else printf("%d-%d",Last[start],Last[i-1]);
			start=i; len=1;
		}
		else len++;
	}
	printf("\n");
//	while(1);
}


#include <iostream>
using namespace std;
#include <stdio.h>
#include <algorithm>
int main()
{
	int T=1,i;
	int Num[110],Last[110];
	scanf("%d",&Num[0]);
	while(scanf(",%d",&Num[T])!=EOF)
		T++;
	sort(Num,Num+T);
	int P=1;
	Last[0]=Num[0];
	for( i=1;i<T;i++)
	{
		if(Num[i]==Num[i-1]) continue;
		Last[P++]=Num[i];
	}
	bool flag=false;
	bool first=true;
	int start=0,len=1;
	for( i=1;i<P;i++)
	{
		if(i==P-1)
		{
			if(Last[i]!=Last[i-1]+1)
			{
				if(first==false) printf(",");
				else first=false;
				if(len==1) printf("%d",Last[start]);
				else printf("%d-%d",Last[start],Last[i-1]);
				printf(",%d",Last[i]);
				start=i; len=1;
			}
			else printf("%d-%d",Last[start],Last[i]);
			break;
		}
		if(Last[i]!=Last[i-1]+1)
		{
			if(first==false) printf(",");
			else first=false;
			if(len==1) printf("%d",Last[start]);
			else printf("%d-%d",Last[start],Last[i-1]);
			start=i; len=1;
		}
		else len++;
	}
	printf("\n");
	//while(1);
	return 0;
}


/*
    HARSHAD VAGHASIYA

        @DAIICT

          H_M_Vaghasiya

            */
#include<bits/stdc++.h>
using namespace std;
#define FS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define MAX_INT 100000
#define ld long double
#define pb push_back
#define mp make_pair
#define pu push
#define vsz(v) cout<<v.size()<<endl;
#define printv(v) for(ll i=0;i<v.size();i++)cout<<v[i]<<" "; cout<<endl;
#define printa(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" ";cout<<endl;
#define printrv(v) for(ll i=v.size()-1;i>=0;i--)cout<<v[i]<<" "; cout<<endl;
#define printvpair(v) for(ll i=0;i<v.size();i++)cout<<v[i].first<<" "<<v[i].second<<endl;
#define sz size()
#define ff first
#define ss second
#define vll vector<ll>
#define vbool vector<bool>
#define vpll vector<pair<ll,ll>>
#define vvpll vector<vector<pair<ll,ll>>>
#define qll queue<ll>
#define dqll deque<ll>
#define pll pair<ll,ll>
#define vllv vector<vector<ll>>
#define setpri(x) cout<<setprecision(x);
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define inf 1000000000000
ll MOD=1e9+7;
ll ceil1(ll n,ll x){if(n%x==0)return n/x; else return (n/x)+1;}
ll gcd(ll a,ll b){return __gcd(a,b);}
ll lcm(ll a,ll b){return (max(a,b)/gcd(a,b))*min(a,b);}
ll fact(ll n){ll s=1; for(ll i=1;i<=n;i++)s*=i; return s;}
vll fact1tonmod(ll n,ll mod){vll  ans(n+1);ans[0]=ans[1]=1;
	for(ll i=2;i<=n;i++)ans[i]=(ans[i-1]*i)%mod;
	return ans;
}
ll ncrmod(ll n,ll r,ll mod){if(n==1 || r==0 || n==r)return 1;if(r>n/2)r=n-r;
	ll ans=1;for(ll i=1;i<=r;i++){ans=(((ans * n )/i)%mod);n--;}return ans;
}
ll ncr(ll n,ll r){if(n==1 || r==0)return 1;if(r>n/2)r=n-r;
	ll ans=1;for(ll i=1;i<=r;i++){ans=((ans * n )/i);n--;}return ans;
}
ll ncrsum(ll n,ll r, ll mod){
	if(n==1 || r==0)return 1;
	ll ans=1,sum=1;for(ll i=1;i<=r;i++){ans=(((ans * n )/i)%mod);n--;sum+=ans;sum%=mod;}return sum;
}
bool isprime(ll n){if(n==1 || (n!=2 && n%2==0))return false; if(n==2)return true;
		for(ll i=3;i<=sqrt(n);i+=2)if(n%i==0)return false; return true; }
vll createprime(ll n){
	vector<bool> prime(n+1,true);vll ans;;prime[0]=prime[1]=false;
	for(ll i=2;i*i<=n;i++)if(prime[i])for(ll j=i*i;j<=n;j+=i)prime[j]=false;
	for(ll i=2;i<=n;i++)if(prime[i])ans.pb(i);
	return ans;
}
vbool createprimebool(ll n){
	vector<bool> prime(n+1,true);prime[0]=prime[1]=false;
	for(ll i=2;i*i<=n;i++)if(prime[i])for(ll j=i*i;j<=n;j+=i)prime[j]=false;
	return prime;
}
vll factor(ll n){
	vll ans;
	if(n>0)ans.pb(1);if(n==2)ans.pb(2);
	for(ll i=2;i*i<=n;i++){if(n%i==0){ans.pb(i);if(n/i!=i)ans.pb(n/i);}}if(n>2)ans.pb(n);
	return ans;
}
ll numoffactor(ll n){ return factor(n).sz;}
ll pow1(ll n,ll k,ll mm){
    if(k==0)return 1;
    if(k%2==0)return (pow1((n%mm)*(n%mm),k/2,mm))%mm;
    return ((n%mm)*(pow1((n%mm)*(n%mm),k/2,mm)%mm))%mm;
}
ll pow2(ll n,ll k){ll ans=1;
	while(k>0){
        if(k%2==1)ans=ans*n;n=n*n;k/=2;
    }return ans;
}
ll modinv(ll A,ll M){return pow1(A,M-2,M);}
bool func(pair<ll,ll> &a,pair<ll,ll> &b ){
	return a.first > b.first;}
void solve(){
    ll i,j,k,n,m,x,y,c,z;
	cin>>n>>k;
	ll t;
	j=k;
	k=2*k +1;
	 t=ceil1(n,k);
	cout<<t<<endl;
	i=1;
	 if(t*k - k <n)i=j+1;
	while(i<=n){
		cout<<i<<" ";
		i+=k;
	}
	i-=k;
	if(i+j<n)cout<<n-j;
}
int main(){
	FS;
	ll i,j,k,n,m,x,y,z,q;
	q=1;
	//cin>>q;
	while(q--){
		solve();
	}
	return 0;
}


/*
    HARSHAD VAGHASIYA

        @DAIICT

          H_M_Vaghasiya

            */
#include<bits/stdc++.h>
using namespace std;
#define FS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define MAX_INT 100000
#define ld long double
#define pb push_back
#define mp make_pair
#define pu push
#define vsz(v) cout<<v.size()<<endl;
#define printv(v) for(ll i=0;i<v.size();i++)cout<<v[i]<<" "; cout<<endl;
#define printa(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" ";cout<<endl;
#define printrv(v) for(ll i=v.size()-1;i>=0;i--)cout<<v[i]<<" "; cout<<endl;
#define printvpair(v) for(ll i=0;i<v.size();i++)cout<<v[i].first<<" "<<v[i].second<<endl;
#define sz size()
#define ff first
#define ss second
#define vll vector<ll>
#define vbool vector<bool>
#define vpll vector<pair<ll,ll>>
#define vvpll vector<vector<pair<ll,ll>>>
#define qll queue<ll>
#define dqll deque<ll>
#define pll pair<ll,ll>
#define vllv vector<vector<ll>>
#define setpri(x) cout<<setprecision(x);
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define inf 1000000000000
ll MOD=1e9+7;
ll ceil1(ll n,ll x){if(n%x==0)return n/x; else return (n/x)+1;}
ll gcd(ll a,ll b){return __gcd(a,b);}
ll lcm(ll a,ll b){return (max(a,b)/gcd(a,b))*min(a,b);}
ll fact(ll n){ll s=1; for(ll i=1;i<=n;i++)s*=i; return s;}
vll fact1tonmod(ll n,ll mod){vll  ans(n+1);ans[0]=ans[1]=1;
	for(ll i=2;i<=n;i++)ans[i]=(ans[i-1]*i)%mod;
	return ans;
}
ll ncrmod(ll n,ll r,ll mod){if(n==1 || r==0 || n==r)return 1;if(r>n/2)r=n-r;
	ll ans=1;for(ll i=1;i<=r;i++){ans=(((ans * n )/i)%mod);n--;}return ans;
}
ll ncr(ll n,ll r){if(n==1 || r==0)return 1;if(r>n/2)r=n-r;
	ll ans=1;for(ll i=1;i<=r;i++){ans=((ans * n )/i);n--;}return ans;
}
ll ncrsum(ll n,ll r, ll mod){
	if(n==1 || r==0)return 1;
	ll ans=1,sum=1;for(ll i=1;i<=r;i++){ans=(((ans * n )/i)%mod);n--;sum+=ans;sum%=mod;}return sum;
}
bool isprime(ll n){if(n==1 || (n!=2 && n%2==0))return false; if(n==2)return true;
		for(ll i=3;i<=sqrt(n);i+=2)if(n%i==0)return false; return true; }
vll createprime(ll n){
	vector<bool> prime(n+1,true);vll ans;;prime[0]=prime[1]=false;
	for(ll i=2;i*i<=n;i++)if(prime[i])for(ll j=i*i;j<=n;j+=i)prime[j]=false;
	for(ll i=2;i<=n;i++)if(prime[i])ans.pb(i);
	return ans;
}
vbool createprimebool(ll n){
	vector<bool> prime(n+1,true);prime[0]=prime[1]=false;
	for(ll i=2;i*i<=n;i++)if(prime[i])for(ll j=i*i;j<=n;j+=i)prime[j]=false;
	return prime;
}
vll factor(ll n){
	vll ans;
	if(n>0)ans.pb(1);if(n==2)ans.pb(2);
	for(ll i=2;i*i<=n;i++){if(n%i==0){ans.pb(i);if(n/i!=i)ans.pb(n/i);}}if(n>2)ans.pb(n);
	return ans;
}
ll numoffactor(ll n){ return factor(n).sz;}
ll pow1(ll n,ll k,ll mm){
    if(k==0)return 1;
    if(k%2==0)return (pow1((n%mm)*(n%mm),k/2,mm))%mm;
    return ((n%mm)*(pow1((n%mm)*(n%mm),k/2,mm)%mm))%mm;
}
ll pow2(ll n,ll k){ll ans=1;
	while(k>0){
        if(k%2==1)ans=ans*n;n=n*n;k/=2;
    }return ans;
}
ll modinv(ll A,ll M){return pow1(A,M-2,M);}
bool func(pair<ll,ll> &a,pair<ll,ll> &b ){
	return a.first > b.first;}
void solve(){
    ll i,j,k,n,m,x,y,c,z;
	cin>>n>>k;
	ll t;
	k=2*k +1;
	 t=ceil1(n,k);
	cout<<t<<endl;
	i=1;
	while(i<=n){
		cout<<i<<" ";
		i+=k;
	}
}
int main(){
	FS;
	ll i,j,k,n,m,x,y,z,q;
	q=1;
	//cin>>q;
	while(q--){
		solve();
	}
	return 0;
}


/*
    HARSHAD VAGHASIYA

        @DAIICT

          H_M_Vaghasiya

            */
#include<bits/stdc++.h>
using namespace std;
#define FS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define MAX_INT 100000
#define ld long double
#define pb push_back
#define mp make_pair
#define pu push
#define vsz(v) cout<<v.size()<<endl;
#define printv(v) for(ll i=0;i<v.size();i++)cout<<v[i]<<" "; cout<<endl;
#define printa(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" ";cout<<endl;
#define printrv(v) for(ll i=v.size()-1;i>=0;i--)cout<<v[i]<<" "; cout<<endl;
#define printvpair(v) for(ll i=0;i<v.size();i++)cout<<v[i].first<<" "<<v[i].second<<endl;
#define sz size()
#define ff first
#define ss second
#define vll vector<ll>
#define vbool vector<bool>
#define vpll vector<pair<ll,ll>>
#define vvpll vector<vector<pair<ll,ll>>>
#define qll queue<ll>
#define dqll deque<ll>
#define pll pair<ll,ll>
#define vllv vector<vector<ll>>
#define setpri(x) cout<<setprecision(x);
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define inf 1000000000000
ll MOD=1e9+7;
ll ceil1(ll n,ll x){if(n%x==0)return n/x; else return (n/x)+1;}
ll gcd(ll a,ll b){return __gcd(a,b);}
ll lcm(ll a,ll b){return (max(a,b)/gcd(a,b))*min(a,b);}
ll fact(ll n){ll s=1; for(ll i=1;i<=n;i++)s*=i; return s;}
vll fact1tonmod(ll n,ll mod){vll  ans(n+1);ans[0]=ans[1]=1;
	for(ll i=2;i<=n;i++)ans[i]=(ans[i-1]*i)%mod;
	return ans;
}
ll ncrmod(ll n,ll r,ll mod){if(n==1 || r==0 || n==r)return 1;if(r>n/2)r=n-r;
	ll ans=1;for(ll i=1;i<=r;i++){ans=(((ans * n )/i)%mod);n--;}return ans;
}
ll ncr(ll n,ll r){if(n==1 || r==0)return 1;if(r>n/2)r=n-r;
	ll ans=1;for(ll i=1;i<=r;i++){ans=((ans * n )/i);n--;}return ans;
}
ll ncrsum(ll n,ll r, ll mod){
	if(n==1 || r==0)return 1;
	ll ans=1,sum=1;for(ll i=1;i<=r;i++){ans=(((ans * n )/i)%mod);n--;sum+=ans;sum%=mod;}return sum;
}
bool isprime(ll n){if(n==1 || (n!=2 && n%2==0))return false; if(n==2)return true;
		for(ll i=3;i<=sqrt(n);i+=2)if(n%i==0)return false; return true; }
vll createprime(ll n){
	vector<bool> prime(n+1,true);vll ans;;prime[0]=prime[1]=false;
	for(ll i=2;i*i<=n;i++)if(prime[i])for(ll j=i*i;j<=n;j+=i)prime[j]=false;
	for(ll i=2;i<=n;i++)if(prime[i])ans.pb(i);
	return ans;
}
vbool createprimebool(ll n){
	vector<bool> prime(n+1,true);prime[0]=prime[1]=false;
	for(ll i=2;i*i<=n;i++)if(prime[i])for(ll j=i*i;j<=n;j+=i)prime[j]=false;
	return prime;
}
vll factor(ll n){
	vll ans;
	if(n>0)ans.pb(1);if(n==2)ans.pb(2);
	for(ll i=2;i*i<=n;i++){if(n%i==0){ans.pb(i);if(n/i!=i)ans.pb(n/i);}}if(n>2)ans.pb(n);
	return ans;
}
ll numoffactor(ll n){ return factor(n).sz;}
ll pow1(ll n,ll k,ll mm){
    if(k==0)return 1;
    if(k%2==0)return (pow1((n%mm)*(n%mm),k/2,mm))%mm;
    return ((n%mm)*(pow1((n%mm)*(n%mm),k/2,mm)%mm))%mm;
}
ll pow2(ll n,ll k){ll ans=1;
	while(k>0){
        if(k%2==1)ans=ans*n;n=n*n;k/=2;
    }return ans;
}
ll modinv(ll A,ll M){return pow1(A,M-2,M);}
bool func(pair<ll,ll> &a,pair<ll,ll> &b ){
	return a.first > b.first;}
void solve(){
    ll i,j,k,n,m,x,y,c,z;
	cin>>n>>k;
	ll t;
	j=k;
	k=2*k +1;
	 t=ceil1(n,k);
	cout<<t<<endl;
	i=j+1;
	while(i<=n){
		cout<<i<<" ";
		i+=k;
	}
}
int main(){
	FS;
	ll i,j,k,n,m,x,y,z,q;
	q=1;
	//cin>>q;
	while(q--){
		solve();
	}
	return 0;
}


/*
    HARSHAD VAGHASIYA

        @DAIICT

          H_M_Vaghasiya

            */
#include<bits/stdc++.h>
using namespace std;
#define FS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define MAX_INT 100000
#define ld long double
#define pb push_back
#define mp make_pair
#define pu push
#define vsz(v) cout<<v.size()<<endl;
#define printv(v) for(ll i=0;i<v.size();i++)cout<<v[i]<<" "; cout<<endl;
#define printa(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" ";cout<<endl;
#define printrv(v) for(ll i=v.size()-1;i>=0;i--)cout<<v[i]<<" "; cout<<endl;
#define printvpair(v) for(ll i=0;i<v.size();i++)cout<<v[i].first<<" "<<v[i].second<<endl;
#define sz size()
#define ff first
#define ss second
#define vll vector<ll>
#define vbool vector<bool>
#define vpll vector<pair<ll,ll>>
#define vvpll vector<vector<pair<ll,ll>>>
#define qll queue<ll>
#define dqll deque<ll>
#define pll pair<ll,ll>
#define vllv vector<vector<ll>>
#define setpri(x) cout<<setprecision(x);
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define inf 1000000000000
ll MOD=1e9+7;
ll ceil1(ll n,ll x){if(n%x==0)return n/x; else return (n/x)+1;}
ll gcd(ll a,ll b){return __gcd(a,b);}
ll lcm(ll a,ll b){return (max(a,b)/gcd(a,b))*min(a,b);}
ll fact(ll n){ll s=1; for(ll i=1;i<=n;i++)s*=i; return s;}
vll fact1tonmod(ll n,ll mod){vll  ans(n+1);ans[0]=ans[1]=1;
	for(ll i=2;i<=n;i++)ans[i]=(ans[i-1]*i)%mod;
	return ans;
}
ll ncrmod(ll n,ll r,ll mod){if(n==1 || r==0 || n==r)return 1;if(r>n/2)r=n-r;
	ll ans=1;for(ll i=1;i<=r;i++){ans=(((ans * n )/i)%mod);n--;}return ans;
}
ll ncr(ll n,ll r){if(n==1 || r==0)return 1;if(r>n/2)r=n-r;
	ll ans=1;for(ll i=1;i<=r;i++){ans=((ans * n )/i);n--;}return ans;
}
ll ncrsum(ll n,ll r, ll mod){
	if(n==1 || r==0)return 1;
	ll ans=1,sum=1;for(ll i=1;i<=r;i++){ans=(((ans * n )/i)%mod);n--;sum+=ans;sum%=mod;}return sum;
}
bool isprime(ll n){if(n==1 || (n!=2 && n%2==0))return false; if(n==2)return true;
		for(ll i=3;i<=sqrt(n);i+=2)if(n%i==0)return false; return true; }
vll createprime(ll n){
	vector<bool> prime(n+1,true);vll ans;;prime[0]=prime[1]=false;
	for(ll i=2;i*i<=n;i++)if(prime[i])for(ll j=i*i;j<=n;j+=i)prime[j]=false;
	for(ll i=2;i<=n;i++)if(prime[i])ans.pb(i);
	return ans;
}
vbool createprimebool(ll n){
	vector<bool> prime(n+1,true);prime[0]=prime[1]=false;
	for(ll i=2;i*i<=n;i++)if(prime[i])for(ll j=i*i;j<=n;j+=i)prime[j]=false;
	return prime;
}
vll factor(ll n){
	vll ans;
	if(n>0)ans.pb(1);if(n==2)ans.pb(2);
	for(ll i=2;i*i<=n;i++){if(n%i==0){ans.pb(i);if(n/i!=i)ans.pb(n/i);}}if(n>2)ans.pb(n);
	return ans;
}
ll numoffactor(ll n){ return factor(n).sz;}
ll pow1(ll n,ll k,ll mm){
    if(k==0)return 1;
    if(k%2==0)return (pow1((n%mm)*(n%mm),k/2,mm))%mm;
    return ((n%mm)*(pow1((n%mm)*(n%mm),k/2,mm)%mm))%mm;
}
ll pow2(ll n,ll k){ll ans=1;
	while(k>0){
        if(k%2==1)ans=ans*n;n=n*n;k/=2;
    }return ans;
}
ll modinv(ll A,ll M){return pow1(A,M-2,M);}
bool func(pair<ll,ll> &a,pair<ll,ll> &b ){
	return a.first > b.first;}
void solve(){
    ll i,j,k,n,m,x,y,c,z;
	cin>>n>>k;
	ll t;
	j=k;
	k=2*k +1;
	 t=ceil1(n,k);
	cout<<t<<endl;
	i=1;
	 //if(t*k - k <n)i=j+1;
	while(i<=n){
		cout<<i<<" ";
		i+=k;
	}
	i-=k;
	if(i+j<n)cout<<n-j;
}
int main(){
	FS;
	ll i,j,k,n,m,x,y,z,q;
	q=1;
	//cin>>q;
	while(q--){
		solve();
	}
	return 0;
}


/*
    HARSHAD VAGHASIYA

        @DAIICT

          H_M_Vaghasiya

            */
#include<bits/stdc++.h>
using namespace std;
#define FS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define MAX_INT 100000
#define ld long double
#define pb push_back
#define mp make_pair
#define pu push
#define vsz(v) cout<<v.size()<<endl;
#define printv(v) for(ll i=0;i<v.size();i++)cout<<v[i]<<" "; cout<<endl;
#define printa(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" ";cout<<endl;
#define printrv(v) for(ll i=v.size()-1;i>=0;i--)cout<<v[i]<<" "; cout<<endl;
#define printvpair(v) for(ll i=0;i<v.size();i++)cout<<v[i].first<<" "<<v[i].second<<endl;
#define sz size()
#define ff first
#define ss second
#define vll vector<ll>
#define vbool vector<bool>
#define vpll vector<pair<ll,ll>>
#define vvpll vector<vector<pair<ll,ll>>>
#define qll queue<ll>
#define dqll deque<ll>
#define pll pair<ll,ll>
#define vllv vector<vector<ll>>
#define setpri(x) cout<<setprecision(x);
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define inf 1000000000000
ll MOD=1e9+7;
ll ceil1(ll n,ll x){if(n%x==0)return n/x; else return (n/x)+1;}
ll gcd(ll a,ll b){return __gcd(a,b);}
ll lcm(ll a,ll b){return (max(a,b)/gcd(a,b))*min(a,b);}
ll fact(ll n){ll s=1; for(ll i=1;i<=n;i++)s*=i; return s;}
vll fact1tonmod(ll n,ll mod){vll  ans(n+1);ans[0]=ans[1]=1;
	for(ll i=2;i<=n;i++)ans[i]=(ans[i-1]*i)%mod;
	return ans;
}
ll ncrmod(ll n,ll r,ll mod){if(n==1 || r==0 || n==r)return 1;if(r>n/2)r=n-r;
	ll ans=1;for(ll i=1;i<=r;i++){ans=(((ans * n )/i)%mod);n--;}return ans;
}
ll ncr(ll n,ll r){if(n==1 || r==0)return 1;if(r>n/2)r=n-r;
	ll ans=1;for(ll i=1;i<=r;i++){ans=((ans * n )/i);n--;}return ans;
}
ll ncrsum(ll n,ll r, ll mod){
	if(n==1 || r==0)return 1;
	ll ans=1,sum=1;for(ll i=1;i<=r;i++){ans=(((ans * n )/i)%mod);n--;sum+=ans;sum%=mod;}return sum;
}
bool isprime(ll n){if(n==1 || (n!=2 && n%2==0))return false; if(n==2)return true;
		for(ll i=3;i<=sqrt(n);i+=2)if(n%i==0)return false; return true; }
vll createprime(ll n){
	vector<bool> prime(n+1,true);vll ans;;prime[0]=prime[1]=false;
	for(ll i=2;i*i<=n;i++)if(prime[i])for(ll j=i*i;j<=n;j+=i)prime[j]=false;
	for(ll i=2;i<=n;i++)if(prime[i])ans.pb(i);
	return ans;
}
vbool createprimebool(ll n){
	vector<bool> prime(n+1,true);prime[0]=prime[1]=false;
	for(ll i=2;i*i<=n;i++)if(prime[i])for(ll j=i*i;j<=n;j+=i)prime[j]=false;
	return prime;
}
vll factor(ll n){
	vll ans;
	if(n>0)ans.pb(1);if(n==2)ans.pb(2);
	for(ll i=2;i*i<=n;i++){if(n%i==0){ans.pb(i);if(n/i!=i)ans.pb(n/i);}}if(n>2)ans.pb(n);
	return ans;
}
ll numoffactor(ll n){ return factor(n).sz;}
ll pow1(ll n,ll k,ll mm){
    if(k==0)return 1;
    if(k%2==0)return (pow1((n%mm)*(n%mm),k/2,mm))%mm;
    return ((n%mm)*(pow1((n%mm)*(n%mm),k/2,mm)%mm))%mm;
}
ll pow2(ll n,ll k){ll ans=1;
	while(k>0){
        if(k%2==1)ans=ans*n;n=n*n;k/=2;
    }return ans;
}
ll modinv(ll A,ll M){return pow1(A,M-2,M);}
bool func(pair<ll,ll> &a,pair<ll,ll> &b ){
	return a.first > b.first;}
void solve(){
    ll i,j,k,n,m,x,y,c,z;
	cin>>n>>k;
	ll t;
	if(k>0){
	k=2*k +1;
	 t=ceil1(n,k);
	}
	else {
		k=1;
		t=n;
	}
	cout<<t<<endl;
	i=1;
	while(i<n){
		cout<<i<<" ";
		i+=k;
	}
}
int main(){
	FS;
	ll i,j,k,n,m,x,y,z,q;
	q=1;
	//cin>>q;
	while(q--){
		solve();
	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios::sync_with_stdio(0);
    int n,k,lef,start;
    cin>>n>>k;
    int ans;
    start=1;
    ans=(n-1)/(2*k+1)+1;
    lef=n-(2*k+1)*(ans-1)-1-k;
    if(lef<0)lef=0;
    start+=lef;
    cout<<ans<<endl;
    while(ans--){
        cout<<start<<" ";
        start+=2*k+1;
    }
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair

using namespace std;

#define MAX 100010

typedef long long int ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vector<int> > vvi;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;

int v[1010];
int tot;
int aux[1010];
int n, k, i, dif;

int main(){

    memset(v, 1, sizeof(v));
    tot = 0;

    scanf("%d%d", &n, &k);

    if(k >= n/2){
        printf("1\n");
        printf("%d\n", n/2);
        return 0;
    }
    dif = 0;
    i = k+1;
    while(i < n){
        aux[tot++] = i;
        i += 2*k+1;
    }

    if(i == n){
        aux[tot++] = n;
    }

    if(n < i){
        dif = (i - n);
        for(int j = 0; j < tot; j++)
            aux[j] -= dif;
        aux[tot] = aux[tot-1] + k + k + 1;
        tot++;
    }

    printf("%d\n", tot);
    for(i = 0; i < tot -1; i++){
        printf("%d ", aux[i]);
    }
    printf("%d\n", aux[i]);

}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair

using namespace std;

#define MAX 100010

typedef long long int ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vector<int> > vvi;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;

int v[1010];
int tot;
int aux[1010];
int n, k, i, dif;

int main(){

    memset(v, 1, sizeof(v));
    tot = 0;

    scanf("%d%d", &n, &k);

    if(k >= n/2){
        printf("1\n");
        printf("%d\n", n/2);
        return 0;
    }
    dif = 0;
    i = k+1;
    while(i <= n){
        aux[tot++] = i;
        i += 2*k+1;
    }

    if(n >= i - k){
        dif = i - n;
        aux[tot++] = aux[tot]+ 2*k + 1 + dif;
    }

    printf("%d\n", tot);
    for(i = 0; i < tot -1; i++){
        printf("%d ", aux[i] - dif);
    }
    printf("%d\n", aux[i] - dif);

}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair

using namespace std;

#define MAX 100010

typedef long long int ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vector<int> > vvi;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;

int v[1010];
int tot;
int aux[1010];
int n, k, i, dif;

int main(){

    memset(v, 1, sizeof(v));
    tot = 0;

    scanf("%d%d", &n, &k);

    if(k >= n/2){
        printf("1\n");
        printf("%d\n", n/2);
        return 0;
    }
    dif = 0;

    if(n == 1){
        printf("1\n");
        printf("1\n");
        return 0;
    }

    i = k+1;
    while(i <= n){
        aux[tot++] = i;
        i += 2*k+1;
    }

    if(aux[tot-1] + k + 1 <= n){
        for(int i = 0; i < tot; i++)
            aux[i] = aux[i]-k;
        aux[tot++] = aux[tot-1] + 2*k + 1;
    }

    printf("%d\n", tot);
    for(i = 0; i < tot -1; i++){
        printf("%d ", aux[i]);
    }
    printf("%d\n", aux[i]);

}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair

using namespace std;

#define MAX 100010

typedef long long int ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vector<int> > vvi;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;

int v[1010];
int tot;
int aux[1010];
int n, k, i, dif;

int main(){

    tot = 0;

    scanf("%d%d", &n, &k);

    if(n == 1){
      printf("1\n");
      printf("1\n");
      return 0;
    }
    if(k >= n/2){
        printf("1\n");
        printf("%d\n", n/2);
        return 0;
    }
    dif = 0;

    i = k+1;
    while(i <= n){
        aux[tot++] = i;
        i += 2*k+1;
    }

    if(aux[tot-1] + k + 1 <= n){
        for(int i = 0; i < tot; i++)
            aux[i] = aux[i]-k;
        aux[tot++] = aux[tot-1] + 2*k + 1;
    }

    printf("%d\n", tot);
    for(i = 0; i < tot -1; i++){
        printf("%d ", aux[i]);
    }
    printf("%d\n", aux[i]);

}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair

using namespace std;

#define MAX 100010

typedef long long int ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vector<int> > vvi;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;

int v[1010];
int tot;
int aux[1010];
int n, k, i, dif;

int main(){

    tot = 0;
    int meio;

    scanf("%d%d", &n, &k);

    if(k >= n/2){
        meio = n/2;
        if(n%2){
            meio++;
        }
        printf("1\n");
        printf("%d\n", meio);
        return 0;
    }
    dif = 0;

    i = k+1;
    while(i <= n){
        aux[tot++] = i;
        i += 2*k+1;
    }

    if(aux[tot-1] + k + 1 <= n){
        for(int i = 0; i < tot; i++)
            aux[i] = aux[i]-k;
        aux[tot++] = aux[tot-1] + 2*k + 1;
    }

    printf("%d\n", tot);
    for(i = 0; i < tot -1; i++){
        printf("%d ", aux[i]);
    }
    printf("%d\n", aux[i]);

}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair

using namespace std;

#define MAX 100010

typedef long long int ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vector<int> > vvi;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;

int v[1010];
int tot;
int aux[1010];
int n, k, i, dif;

int main(){

    memset(v, 1, sizeof(v));
    tot = 0;

    scanf("%d%d", &n, &k);

    if(k >= n/2){
        printf("1\n");
        printf("%d\n", n/2);
        return 0;
    }
    dif = 0;

    i = k+1;
    while(i <= n){
        aux[tot++] = i;
        i += 2*k+1;
    }

    if(aux[tot-1] + k + 1 <= n){
        for(int i = 0; i < tot; i++)
            aux[i] = aux[i]-k;
        aux[tot++] = aux[tot-1] + 2*k + 1;
    }

    printf("%d\n", tot);
    for(i = 0; i < tot -1; i++){
        printf("%d ", aux[i]);
    }
    printf("%d\n", aux[i]);

}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair

using namespace std;

#define MAX 100010

typedef long long int ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vector<int> > vvi;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;

int v[1010];
int tot;
int aux[1010];
int n, k, i, dif;

int main(){

    memset(v, 1, sizeof(v));
    tot = 0;

    scanf("%d%d", &n, &k);

    if(k >= n/2){
        printf("1\n");
        printf("%d\n", n/2);
        return 0;
    }
    dif = 0;
    i = 1;
    while(i < n){
        aux[tot++] = i;
        i += 2*k+1;
    }
    //
    // if(n < i - k){
    //     dif = i - k - n;
    // }

    printf("%d\n", tot);
    for(i = 0; i < tot -1; i++){
        printf("%d ", aux[i] - dif);
    }
    printf("%d\n", aux[i] - dif);

}


#include<bits/stdc++.h>
using namespace std;

typedef pair<long long int,long long int> pa;
typedef pair<int,int> pi;
#define pb push_back
#define pf push_front
#define mp make_pair
#define f first
#define s second
#define  MAX 500009
#define ll long long int
#define re return 0
#define co continue
long long int MOD=998244353;
long long int mod=1e9+7;
long long int INF=1e18;
ll dx[]={1,-1,0,0};
ll dy[]={0,0,1,-1};

/*
bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}
*/

/*
Sieve
int n;
vector<char> is_prime(n+1, true);
is_prime[0] = is_prime[1] = false;
for (int i = 2; i * i <= n; i++) {
    if (is_prime[i]) {
        for (int j = i * i; j <= n; j += i)
            is_prime[j] = false;
    }
}
*/

const int M = 200 * 1000 + 11;

ll gcd(ll a,ll b)
{
	return __gcd(a,b);
}

long long binpow(long long a, long long b, long long m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	ll t,n,i,k,p,cnt=0;
	cin>>n>>k;
	if(k==0)
	{
		cout<<n<<endl;
		for(i=1;i<=n;i++)
		{
			cout<<i<<" ";
		}
		re;
	}
	double x=n,y=k;
	ll ans=ceil(x/(2*y+1));
	cout<<ans<<endl;

	p=ans*(2*y+1)-n;

	if(p==0)
	{
		for(i=k+1;i<=n;i+=(2*k+1))
		{
			cout<<i<<" ";
		}
		re;
	}
	ll g=2*k-p;
	ll a=min(g,k);
	ll b=g-a;
	for(i=a+1;i<=n;i+=(2*k+1))
	{
		cout<<i<<" ";
		cnt++;
		if(cnt==ans-1)
		{
			break;
		}
	}
	if(cnt!=ans)
	{
		cout<<n-b;
	}

}


#include<bits/stdc++.h>
using namespace std;

typedef pair<long long int,long long int> pa;
typedef pair<int,int> pi;
#define pb push_back
#define pf push_front
#define mp make_pair
#define f first
#define s second
#define  MAX 500009
#define ll long long int
#define re return 0
#define co continue
long long int MOD=998244353;
long long int mod=1e9+7;
long long int INF=1e18;
ll dx[]={1,-1,0,0};
ll dy[]={0,0,1,-1};

/*
bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}
*/

/*
Sieve
int n;
vector<char> is_prime(n+1, true);
is_prime[0] = is_prime[1] = false;
for (int i = 2; i * i <= n; i++) {
    if (is_prime[i]) {
        for (int j = i * i; j <= n; j += i)
            is_prime[j] = false;
    }
}
*/

const int M = 200 * 1000 + 11;

ll gcd(ll a,ll b)
{
	return __gcd(a,b);
}

long long binpow(long long a, long long b, long long m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	ll t,n,i,k,p,cnt=0;
	cin>>n>>k;
	if(k==0)
	{
		for(i=1;i<=n;i++)
		{
			cout<<i<<" ";
		}
		re;
	}
	double x=n,y=k;
	ll ans=ceil(x/(2*y+1));
	cout<<ans<<endl;

	p=ans*(2*y+1)-n;
	ll a=min(n,k);
	ll b=p-a;
	for(i=a;i<=n;i+=(2*k+1))
	{
		cout<<i<<" ";
		cnt++;
	}
	if(cnt!=ans)
	{
		cout<<n-b;
	}

}


#include<bits/stdc++.h>
using namespace std;

typedef pair<long long int,long long int> pa;
typedef pair<int,int> pi;
#define pb push_back
#define pf push_front
#define mp make_pair
#define f first
#define s second
#define  MAX 500009
#define ll long long int
#define re return 0
#define co continue
long long int MOD=998244353;
long long int mod=1e9+7;
long long int INF=1e18;
ll dx[]={1,-1,0,0};
ll dy[]={0,0,1,-1};

/*
bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}
*/

/*
Sieve
int n;
vector<char> is_prime(n+1, true);
is_prime[0] = is_prime[1] = false;
for (int i = 2; i * i <= n; i++) {
    if (is_prime[i]) {
        for (int j = i * i; j <= n; j += i)
            is_prime[j] = false;
    }
}
*/

const int M = 200 * 1000 + 11;

ll gcd(ll a,ll b)
{
	return __gcd(a,b);
}

long long binpow(long long a, long long b, long long m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	ll t,n,i,k,p,cnt=0;
	cin>>n>>k;
	double x=n,y=k;
	ll ans=ceil(x/(2*y+1));
	cout<<ans<<endl;

	p=ans*(2*y+1)-n;
	ll a=min(n,k);
	ll b=p-a;
	for(i=a;i<=n;i+=(2*k+1))
	{
		cout<<i<<" ";
		cnt++;
	}
	if(cnt!=ans)
	{
		cout<<n-b;
	}

}


#include<bits/stdc++.h>
using namespace std;

typedef pair<long long int,long long int> pa;
typedef pair<int,int> pi;
#define pb push_back
#define pf push_front
#define mp make_pair
#define f first
#define s second
#define  MAX 500009
#define ll long long int
#define re return 0
#define co continue
long long int MOD=998244353;
long long int mod=1e9+7;
long long int INF=1e18;
ll dx[]={1,-1,0,0};
ll dy[]={0,0,1,-1};

/*
bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}
*/

/*
Sieve
int n;
vector<char> is_prime(n+1, true);
is_prime[0] = is_prime[1] = false;
for (int i = 2; i * i <= n; i++) {
    if (is_prime[i]) {
        for (int j = i * i; j <= n; j += i)
            is_prime[j] = false;
    }
}
*/

const int M = 200 * 1000 + 11;

ll gcd(ll a,ll b)
{
	return __gcd(a,b);
}

long long binpow(long long a, long long b, long long m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	ll t,n,i,k,p,cnt=0;
	cin>>n>>k;
	if(k==0)
	{
		cout<<n<<endl;
		for(i=1;i<=n;i++)
		{
			cout<<i<<" ";
		}
		re;
	}
	double x=n,y=k;
	ll ans=ceil(x/(2*y+1));
	cout<<ans<<endl;

	p=ans*(2*y+1)-n;
	ll a=min(n,k);
	ll b=p-a;
	for(i=a;i<=n;i+=(2*k+1))
	{
		cout<<i<<" ";
		cnt++;
	}
	if(cnt!=ans)
	{
		cout<<n-b;
	}

}


#include<bits/stdc++.h>
using namespace std;

typedef pair<long long int,long long int> pa;
typedef pair<int,int> pi;
#define pb push_back
#define pf push_front
#define mp make_pair
#define f first
#define s second
#define  MAX 500009
#define ll long long int
#define re return 0
#define co continue
long long int MOD=998244353;
long long int mod=1e9+7;
long long int INF=1e18;
ll dx[]={1,-1,0,0};
ll dy[]={0,0,1,-1};

/*
bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}
*/

/*
Sieve
int n;
vector<char> is_prime(n+1, true);
is_prime[0] = is_prime[1] = false;
for (int i = 2; i * i <= n; i++) {
    if (is_prime[i]) {
        for (int j = i * i; j <= n; j += i)
            is_prime[j] = false;
    }
}
*/

const int M = 200 * 1000 + 11;

ll gcd(ll a,ll b)
{
	return __gcd(a,b);
}

long long binpow(long long a, long long b, long long m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	ll t,n,i,k,p,cnt=0;
	cin>>n>>k;
	if(k==0)
	{
		cout<<n<<endl;
		for(i=1;i<=n;i++)
		{
			cout<<i<<" ";
		}
		re;
	}
	double x=n,y=k;
	ll ans=ceil(x/(2*y+1));
	cout<<ans<<endl;

	p=ans*(2*y+1)-n;

	if(p==0)
	{
		for(i=k+1;i<=n;i+=(2*k+1))
		{
			cout<<i<<" ";
		}
		re;
	}
	ll a=min(n,k);
	ll b=p-a;
	for(i=a;i<=n;i+=(2*k+1))
	{
		cout<<i<<" ";
		cnt++;

	}
	if(cnt!=ans)
	{
		cout<<n-b;
	}

}


#include<bits/stdc++.h>
using namespace std;

typedef pair<long long int,long long int> pa;
typedef pair<int,int> pi;
#define pb push_back
#define pf push_front
#define mp make_pair
#define f first
#define s second
#define  MAX 500009
#define ll long long int
#define re return 0
#define co continue
long long int MOD=998244353;
long long int mod=1e9+7;
long long int INF=1e18;
ll dx[]={1,-1,0,0};
ll dy[]={0,0,1,-1};

/*
bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}
*/

/*
Sieve
int n;
vector<char> is_prime(n+1, true);
is_prime[0] = is_prime[1] = false;
for (int i = 2; i * i <= n; i++) {
    if (is_prime[i]) {
        for (int j = i * i; j <= n; j += i)
            is_prime[j] = false;
    }
}
*/

const int M = 200 * 1000 + 11;

ll gcd(ll a,ll b)
{
	return __gcd(a,b);
}

long long binpow(long long a, long long b, long long m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	ll t,n,i,k,p,cnt=0;
	cin>>n>>k;
	if(k==0)
	{
		cout<<n<<endl;
		for(i=1;i<=n;i++)
		{
			cout<<i<<" ";
		}
		re;
	}
	double x=n,y=k;
	ll ans=ceil(x/(2*y+1));
	cout<<ans<<endl;

	p=ans*(2*y+1)-n;

	if(p==0)
	{
		for(i=k+1;i<=n;i+=(2*k+1))
		{
			cout<<i<<" ";
		}
		re;
	}
	ll a=min(n,k);
	ll b=p-a;
	for(i=b;i<=n;i+=(2*k+1))
	{
		cout<<i<<" ";
		cnt++;

	}
	if(cnt!=ans)
	{
		cout<<n-a;
	}

}


#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    long int n,k,count = 0, last;
    cin>>n>>k;

    long int num = ceil(n/(2.0*k+1));
    cout<<num<<endl;
    long int initial = 1;

    if(k >= n/2)
        cout<<n/2+1;
    else{
        long int numberOfterms = (n+k+1)/(2*k+1);
        for(long int i = 0; i < numberOfterms && initial <= n; i++){
            last = initial;
            count++;
            cout<<initial<<" ";
            initial += 2*k+1;
        }
        if(count < num)
            cout<<last+k+1<<" ";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define long long long

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    long int n,k,count = 0, last;
    cin>>n>>k;

    long int num = ceil(n/(2.0*k+1));
    cout<<num<<endl;
    long int initial = 0;

    if(k >= n/2)
        cout<<n/2+1;
    else{
        long int numberOfterms = (n+k+1)/(2*k+1);
        long int an = k + (numberOfterms - 1) * (2*k + 1);
        long int diff = n - an;
        initial += diff;
        initial = max(initial,1LL);
        for(long int i = 0; i < numberOfterms && initial <= n; i++){
            last = initial;
            count++;
            cout<<initial<<" ";
            initial += 2*k+1;
        }
        if(count < num)
            cout<<last+k+1<<" ";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    long int n,k,count = 0, last;
    cin>>n>>k;

    long int num = ceil(n/(2.0*k+1));
    cout<<num<<endl;

    if(k >= n/2)
        cout<<n/2+1;
    else{
        long int shift = (1 + ceil(sqrt(1 + 8.0*n*(2*k +1)))) / (2 * (2*k +1));
        for(long int i = shift; i < n; i+=2*k+1){
            last = i;
            count++;
            cout<<i<<" ";
        }
        if(count < num)
            cout<<last+k+1<<" ";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    long int n,k,count = 0, last;
    cin>>n>>k;

    long int num = ceil(n/(2.0*k+1));
    cout<<num<<endl;
    long int initial = 1;

    if(k >= n/2)
        cout<<n/2+1;
    else{
        long int numberOfterms = (n+k+1)/(2*k+1);
        for(long int i = 0; i < numberOfterms; i++){
            last = initial;
            count++;
            cout<<initial<<" ";
            initial += 2*k+1;
        }
        if(count < num)
            cout<<last+k+1<<" ";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define long long long

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    long int n,k,count = 0, last;
    cin>>n>>k;

    long int num = ceil(n/(2.0*k+1));
    cout<<num<<endl;
    long int initial = 0;

    if(k >= n/2)
        cout<<n/2+1;
    else{
        long int numberOfterms = (n+k+1)/(2*k+1);
        long int an = 1 + (numberOfterms - 1) * (2*k + 1);
        long int diff = min(an - n,0LL);
        diff = -diff;

        if(numberOfterms == num)
            initial += min(diff,k+1) ;

        initial = max(initial,1LL);
        for(long int i = 0; i < numberOfterms && initial <= n; i++){
            last = initial;
            count++;
            cout<<initial<<" ";
            initial += 2*k+1;
        }
        if(count < num)
            cout<<last+2*k+1<<" ";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    long int n,k,count = 0, last;
    cin>>n>>k;

    long int num = ceil(n/(2.0*k+1));
    cout<<num<<endl;
    long int initial = 1;

    if(k >= n/2)
        cout<<n/2+1;
    else{
        long int numberOfterms = (n+k+1)/(2*k+1);
        for(long int i = 0; i < numberOfterms && initial < n; i++){
            last = initial;
            count++;
            cout<<initial<<" ";
            initial += 2*k+1;
        }
        if(count < num)
            cout<<last+k+1<<" ";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define long long long

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    long int n,k,count = 0, last;
    cin>>n>>k;

    long int num = ceil(n/(2.0*k+1));
    cout<<num<<endl;
    long int initial = 0;

    if(k >= n/2)
        cout<<n/2+1;
    else{
        long int numberOfterms = (n+k+1)/(2*k+1);
        long int an = k + (numberOfterms - 1) * (2*k + 1);
        long int diff = n - an;
        initial += diff + min(an + k + 1 -n,0LL);
        initial = max(initial,1LL);
        for(long int i = 0; i < numberOfterms && initial <= n; i++){
            last = initial;
            count++;
            cout<<initial<<" ";
            initial += 2*k+1;
        }
        if(count < num)
            cout<<last+2*k+1<<" ";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define long long long

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    long int n,k,count = 0, last;
    cin>>n>>k;

    long int num = ceil(n/(2.0*k+1));
    cout<<num<<endl;
    long int initial = 0;

    if(k >= n/2)
        cout<<n/2+1;
    else{
        long int numberOfterms = (n+k+1)/(2*k+1);
        long int an = k + (numberOfterms - 1) * (2*k + 1);

        if(numberOfterms == num){
            long int diff = n - an;
            initial += diff - max(an + k + 1 -n,0LL);
        }
            initial = max(initial,1LL);
        for(long int i = 0; i < numberOfterms && initial <= n; i++){
            last = initial;
            count++;
            cout<<initial<<" ";
            initial += 2*k+1;
        }
        if(count < num)
            cout<<last+2*k+1<<" ";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    long int n,k,count = 0, last;
    cin>>n>>k;

    long int num = ceil(n/(2.0*k+1));
    cout<<num<<endl;

    if(k >= n/2)
        cout<<n/2+1;
    else{
        long int shift = (1 + (sqrt(1 + 8.0*n*(2*k +1))) / (2 * (2*k +1)));
        for(long int i = shift-1; i < n; i+=2*k+1){
            last = i;
            count++;
            cout<<i<<" ";
        }
        if(count < num)
            cout<<last+k+1<<" ";
    }
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define int long long int
using namespace std;
const int maxn = 1e3 + 10;
int see[maxn];
vector <int> v;
main(){
    int n ,k; cin >> n >> k;
    int k2 = 2 * k + 1;
    int cnt = n / k2;
    if(n % k2) cnt++;
    cout << cnt << endl;
    int mark = 0;
    for(int i = 1 ; i <= n ; i++)
        if(mark == k){
            v.pb(i);
            mark = 0;
            i += k;
        }
        else mark++;
    int z = 0;
    int vs = v.size();
    int kp = v[vs - 1] + k + 1;
    int t = max(z ,v[vs - 1] + k - kp + k + 1);
    if(t){
        for(int i = 0 ; i < v.size() ; i++)
            cout << v[i] - t << ' ';
        if(mark) return cout << kp ,0;
    }
    else for(int i = 0 ; i < v.size() ; i++)
            cout << v[i] << ' ';
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define int long long int
using namespace std;
const int maxn = 1e3 + 10;
int see[maxn];
vector <int> v;
main(){
    int n ,k; cin >> n >> k;
    int k2 = 2 * k + 1;
    if(k >= n) return cout << 1 << endl << 1 , 0;
    if(k >= n / 2) return cout << 1 << endl << n / 2 ,0;
    int cnt = n / k2;
    if(n % k2) cnt++;
    cout << cnt << endl;
    int mark = 0;
    for(int i = 1 ; i <= n ; i++)
        if(mark == k){
            v.pb(i);
            mark = 0;
            i += k;
        }
        else mark++;
    int z = 0;
    int vs = v.size();
    int kp = v[vs - 1] + k + 1;
    int t = max(z ,v[vs - 1] + k - kp + k + 1);
    if(t){
        for(int i = 0 ; i < v.size() ; i++)
            cout << v[i] - t << ' ';
        if(mark) return cout << kp ,0;
    }
    else for(int i = 0 ; i < v.size() ; i++)
            cout << v[i] << ' ';
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define int long long int
using namespace std;
const int maxn = 1e3 + 10;
int see[maxn];
vector <int> v;
main(){
    int n ,k; cin >> n >> k;
    int k2 = 2 * k + 1;
    int cnt = n / k2;
    if(n % k2) cnt++;
    cout << cnt << endl;
    int mark = 0;
    for(int i = 1 ; i <= n ; i++)
        if(mark == k){
            v.pb(i);
            mark = 0;
            i += k;
        }
        else mark++; mark = 0;
    int vs = v.size();
    int kp = v[vs - 1] + k + 1;
    int t = max(mark ,v[vs - 1] + k - kp + k + 1);
    if(t){
        for(int i = 0 ; i < v.size() ; i++)
            cout << v[i] - t << ' ';
        return cout << kp ,0;
    }
    else for(int i = 0 ; i < v.size() ; i++)
            cout << v[i] << ' ';
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define int long long int
using namespace std;
const int maxn = 1e3 + 10;
int see[maxn];
vector <int> v;
main(){
    int n ,k; cin >> n >> k;
    int k2 = 2 * k + 1;
    int cnt = n / k2;
    if(n % k2) cnt++;
    cout << cnt << endl;
    int mark = 0;
    for(int i = 1 ; i <= n ; i++)
        if(mark == k){
            v.pb(i);
            mark = 0;
            i += k;
        }
        else mark++;
    if(mark){
        for(int i = 0 ; i < v.size() ; i++)
            cout << v[i] - mark << ' ';
        return cout << n ,0;
    }
    else for(int i = 0 ; i < v.size() ; i++)
            cout << v[i] << ' ';
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define int long long int
using namespace std;
const int maxn = 1e3 + 10;
int see[maxn];
vector <int> v;
main(){
    int n ,k; cin >> n >> k;
    int k2 = 2 * k + 1;
    if(k >= n) return cout << 1 << endl << 1 , 0;
    if(k > n / 2) return cout << 1 << endl << n / 2 ,0;
    else if(k == n / 2)
        if(n % k) return cout << 1 << endl << n / 2 + 1 ,0;
        else return cout << 1 << endl << n / 2 ,0;
    int cnt = n / k2;
    if(n % k2) cnt++;
    cout << cnt << endl;
    int mark = 0;
    for(int i = 1 ; i <= n ; i++)
        if(mark == k){
            v.pb(i);
            mark = 0;
            i += k;
        }
        else mark++;
    int z = 0;
    int vs = v.size();
    int kp = v[vs - 1] + k + 1;
    int t = max(z ,v[vs - 1] + k - kp + k + 1);
    if(t and mark){
        for(int i = 0 ; i < v.size() ; i++)
            cout << v[i] - t << ' ';
        return cout << kp ,0;
    }
    else for(int i = 0 ; i < v.size() ; i++)
            cout << v[i] << ' ';
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define int long long int
using namespace std;
const int maxn = 1e3 + 10;
int see[maxn];
vector <int> v;
main(){
    int n ,k; cin >> n >> k;
    int k2 = 2 * k + 1;
    if(!k){
        cout << n << endl;
        for(int i = 1 ; i <= n ; i++)
            cout << i << ' ';
        return 0;
    }
    if(k >= n) return cout << 1 << endl << 1 , 0;
    if(k >= n / 2)
        return cout << 1 << endl << (n + 1) / 2 ,0;
    int cnt = n / k2;
    if(n % k2) cnt++;
    cout << cnt << endl;
    int mark = 0;
    for(int i = 1 ; i <= n ; i++)
        if(mark == k){
            v.pb(i);
            mark = 0;
            i += k;
        }
        else mark++;
    int z = 0;
    int vs = v.size();
    int kp = v[vs - 1] + k + 1;
    int t = max(z ,v[vs - 1] + k - kp + k + 1);
    if(t and mark){
        for(int i = 0 ; i < v.size() ; i++)
            cout << v[i] - t << ' ';
        return cout << kp ,0;
    }
    else for(int i = 0 ; i < v.size() ; i++)
            cout << v[i] << ' ';
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define int long long int
using namespace std;
const int maxn = 1e3 + 10;
int see[maxn];
vector <int> v;
main(){
    int n ,k; cin >> n >> k;
    int k2 = 2 * k + 1;
    if(!k){
        cout << n << endl;
        for(int i = 1 ; i <= n ; i++)
            cout << i << ' ';
        return 0;
    }
    if(k >= n) return cout << 1 << endl << 1 , 0;
    if(k > n / 2) return cout << 1 << endl << n / 2 ,0;
    else if(k == n / 2)
        if(n % k) return cout << 1 << endl << n / 2 + 1 ,0;
        else return cout << 1 << endl << n / 2 ,0;
    int cnt = n / k2;
    if(n % k2) cnt++;
    cout << cnt << endl;
    int mark = 0;
    for(int i = 1 ; i <= n ; i++)
        if(mark == k){
            v.pb(i);
            mark = 0;
            i += k;
        }
        else mark++;
    int z = 0;
    int vs = v.size();
    int kp = v[vs - 1] + k + 1;
    int t = max(z ,v[vs - 1] + k - kp + k + 1);
    if(t and mark){
        for(int i = 0 ; i < v.size() ; i++)
            cout << v[i] - t << ' ';
        return cout << kp ,0;
    }
    else for(int i = 0 ; i < v.size() ; i++)
            cout << v[i] << ' ';
    return 0;
}


#include <bits/stdc++.h>
#define int long long int
using namespace std;
const int maxn = 1e3 + 10;
int see[maxn];
main(){
    int n ,k; cin >> n >> k;
    int k2 = 2 * k + 1;
    int cnt = n / k2;
    if(n % k2) cnt++;
    cout << cnt << endl;
    int mark = 0;
    for(int i = 1 ; i <= n ; i++)
        if(mark == k){
            cout << i << ' ';
            mark = 0;
            i += k;
        }
        else if(i == n)
            return cout << i << ' ' ,0;
        else mark++;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main(int argc, char const *argv[])
{
    int range, wings;
    cin >> range >> wings;
    cout << (range - 1) / (2 * wings + 1) + 1 << "\n";
    int start = wings, r = range % (2 * wings + 1);
    if (r > 0 && r <= wings)
        start -= r;
    cout << start + 1;
    start += (2 * wings + 1);
    while (start < range) {
        cout << " " << start + 1;
        start += (2 * wings + 1);
    }
    cout << "\n";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main(int argc, char const *argv[])
{
    int range, wings;
    cin >> range >> wings;
    cout << (range - 1) / (2 * wings + 1) + 1 << "\n";
    int start = wings, r = range % (2 * wings + 1);
    if (r > 0 && r <= wings)
        start -= r;
    cout << start + 1;
    start += (2 * wings + 1);
    while (start <= range) {
        cout << " " << start + 1;
        start += (2 * wings + 1);
    }
    cout << "\n";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main(int argc, char const *argv[])
{
    int range, wings;
    cin >> range >> wings;
    wings = min(wings, range);
    cout << (range - 1) / (2 * wings + 1) + 1 << "\n";
    int start = wings, r = range % (2 * wings + 1);
    if (r > 0 && r <= wings)
        start -= (wings - r + 1);
    cout << start + 1;
    start += (2 * wings + 1);
    while (start < range) {
        cout << " " << start + 1;
        start += (2 * wings + 1);
    }
    cout << "\n";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, k;
    scanf("%d %d", &n, &k);

    int x = (n + 2 * k) / (2 * k + 1); // ceil
    int ans[x];
    int pos = 0;
    for (int i = 0; i < x; i++) {
        ans[i] = pos;
        pos += 2 * k + 1;
    }

    if (ans[x - 1] + k <= n - 1) {
        int diff = n - 1 - (ans[x - 1] + k);
        for (int i = 0; i < x; i++)
            ans[i] += diff;
    }

    printf("%d\n", x);
    for (int i = 0; i < x; i++)
        printf("%d%c", ans[i] + 1, i == x - 1 ? '\n' : ' ');

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main(int argc, char const *argv[])
{
    int range, wings;
    cin >> range >> wings;
    wings = min(wings, range);
    cout << (range - 1) / (2 * wings + 1) + 1 << "\n";
    int start = wings, r = range % (2 * wings + 1);
    if (r > 0 && r <= wings)
        start -= r;
    cout << start + 1;
    start += (2 * wings + 1);
    while (start < range) {
        cout << " " << start + 1;
        start += (2 * wings + 1);
    }
    cout << "\n";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main(int argc, char const *argv[])
{
    int range, wings;
    cin >> range >> wings;
    wings = min(wings, range);
    cout << (range - 1) / (2 * wings + 1) + 1 << "\n";
    int start = wings, r = range % (2 * wings + 1);
    if (r > 0 && r <= wings)
        start -= wings - r;
    cout << start + 1;
    start += (2 * wings + 1);
    while (start < range) {
        cout << " " << start + 1;
        start += (2 * wings + 1);
    }
    cout << "\n";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, k;
    scanf("%d %d", &n, &k);

    int x = (n + 2 * k) / (2 * k + 1); // ceil
    int ans[x];
    int pos = 0;
    for (int i = 0; i < x; i++) {
        ans[i] = pos;
        pos += 2 * k + 1;
    }

    if (ans[x - 1] + k != n - 1) {
        int diff = n - 1 - ans[x - 1];
        for (int i = 0; i < x; i++)
            ans[i] += diff;
    }

    printf("%d\n", x);
    for (int i = 0; i < x; i++)
        printf("%d%c", ans[i], i == x - 1 ? '\n' : ' ');

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, k;
    scanf("%d %d", &n, &k);

    int x = (n + 2 * k) / (2 * k + 1); // ceil
    int ans[x];
    int pos = 0;
    for (int i = 0; i < x; i++) {
        ans[i] = pos;
        pos += 2 * k + 1;
    }

    if (ans[x - 1] + k != n - 1) {
        int diff = n - 1 - ans[x - 1];
        for (int i = 0; i < x; i++)
            ans[i] += diff;
    }

    printf("%d\n", x);
    for (int i = 0; i < x; i++)
        printf("%d%c", ans[i] + 1, i == x - 1 ? '\n' : ' ');

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, k;
    scanf("%d %d", &n, &k);

    int x = (n + 2 * k) / (2 * k + 1); // ceil
    int ans[x];
    int pos = 0;
    for (int i = 0; i < x; i++) {
        ans[i] = pos;
        pos += 2 * k + 1;
    }

    if (ans[x - 1] + k != n - 1) {
        int diff = n - 1 - (ans[x - 1] + k);
        for (int i = 0; i < x; i++)
            ans[i] += diff;
    }

    printf("%d\n", x);
    for (int i = 0; i < x; i++)
        printf("%d%c", ans[i] + 1, i == x - 1 ? '\n' : ' ');

    return 0;
}


/*Made by Shivam Solanki*/
#include<bits/stdc++.h>
#pragma GCC optimize ("Ofast")
using namespace std;
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define ll long long int
#define endl '\n'
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<pii> vp;
typedef vector<pll> vpll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef set<int> sii;
typedef set<ll> sll;
typedef queue<int> qii;
typedef priority_queue<int> pq;
typedef unordered_map<int,int> umii;
typedef unordered_map<ll,ll> umll;
#define all(x) x.begin(),x.end()
#define rep(i,k,n) for (int i = k; i < n; ++i)
#define repr(i,k,n) for (int i = n; i>=k; --i)
#define repll(i,k,n) for (ll i = k; i < n; ++i)
#define pb push_back
#define mp make_pair
#define gcd __gcd
#define F first
#define S second
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int INF = 1e9+5;
const int MOD = 1e9+7;
double pi = 2 * acos(0.0);

void solve(){
    int n,k;
    cin>>n>>k;
    vi marked(n,0);
    int max_spread=(k*2);
    vi ans;
    // if(n>=max_spread){
        int l=0;
        int r=min(n-1,2*k);
        ans.pb(min(n,k+1));
        rep(i,l,r+1){
            marked[i]=1;
        }
    // }
    rep(i,0,n){
        if(marked[i]==0){
            int l=max(0,i-k);
            int r=min(n-1,i+k);
            bool f=0;
            // cout<<l<<' '<<r<<'\n';
            if(marked[l]==0 and marked[r]==0){
                ans.pb(i+1);
                rep(i,l,r+1){
                    marked[i]=1;
                }
            }
        }
    }
    bool f=0;
    rep(i,0,n){
        if(marked[i]==0){
            f=1;
            break;
        }
    }
    if(f){
        marked=vi(n,0);
        ans.clear();
        rep(i,0,n){
            if(marked[i]==0){
                int l=max(0,i-k);
                int r=min(n-1,i+k);
                bool f=0;
                // cout<<l<<' '<<r<<'\n';
                if(marked[l]==0 and marked[r]==0){
                    ans.pb(i+1);
                    rep(i,l,r+1){
                        marked[i]=1;
                    }
                }
            }
        }
    }
    cout<<ans.size()<<'\n';
    rep(i,0,ans.size()){
        cout<<ans[i]<<' ';
    }
}

int main(){
    // #ifndef ONLINE_JUDGE
        // freopen("input.txt", "r", stdin);
        // freopen("output.txt", "w", stdout);
    // #endif
    fastio;
    int t=1;
    // cin>>t;
    while(t--)
        solve();
    return 0;
}


/*Made by Shivam Solanki*/
#include<bits/stdc++.h>
#pragma GCC optimize ("Ofast")
using namespace std;
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define ll long long int
#define endl '\n'
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<pii> vp;
typedef vector<pll> vpll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef set<int> sii;
typedef set<ll> sll;
typedef queue<int> qii;
typedef priority_queue<int> pq;
typedef unordered_map<int,int> umii;
typedef unordered_map<ll,ll> umll;
#define all(x) x.begin(),x.end()
#define rep(i,k,n) for (int i = k; i < n; ++i)
#define repr(i,k,n) for (int i = n; i>=k; --i)
#define repll(i,k,n) for (ll i = k; i < n; ++i)
#define pb push_back
#define mp make_pair
#define gcd __gcd
#define F first
#define S second
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int INF = 1e9+5;
const int MOD = 1e9+7;
double pi = 2 * acos(0.0);

void solve(){
    int n,k;
    cin>>n>>k;
    vi marked(n,0);
    int max_spread=(k*2);
    vi ans;
    // if(n>=max_spread){
        int l=0;
        int r=min(n-1,2*k);
        ans.pb(k+1);
        rep(i,l,r+1){
            marked[i]=1;
        }
    // }
    rep(i,0,n){
        if(marked[i]==0){
            int l=max(0,i-k);
            int r=min(n-1,i+k);
            bool f=0;
            // cout<<l<<' '<<r<<'\n';
            if(marked[l]==0 and marked[r]==0){
                ans.pb(i+1);
                rep(i,l,r+1){
                    marked[i]=1;
                }
            }
        }
    }
    bool f=0;
    rep(i,0,n){
        if(marked[i]==0){
            f=1;
            break;
        }
    }
    if(f){
        marked=vi(n,0);
        ans.clear();
        rep(i,0,n){
            if(marked[i]==0){
                int l=max(0,i-k);
                int r=min(n-1,i+k);
                bool f=0;
                // cout<<l<<' '<<r<<'\n';
                if(marked[l]==0 and marked[r]==0){
                    ans.pb(i+1);
                    rep(i,l,r+1){
                        marked[i]=1;
                    }
                }
            }
        }
    }
    cout<<ans.size()<<'\n';
    rep(i,0,ans.size()){
        cout<<ans[i]<<' ';
    }
}

int main(){
    // #ifndef ONLINE_JUDGE
        // freopen("input.txt", "r", stdin);
        // freopen("output.txt", "w", stdout);
    // #endif
    fastio;
    int t=1;
    // cin>>t;
    while(t--)
        solve();
    return 0;
}


/*Made by Shivam Solanki*/
#include<bits/stdc++.h>
#pragma GCC optimize ("Ofast")
using namespace std;
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define ll long long int
#define endl '\n'
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<pii> vp;
typedef vector<pll> vpll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef set<int> sii;
typedef set<ll> sll;
typedef queue<int> qii;
typedef priority_queue<int> pq;
typedef unordered_map<int,int> umii;
typedef unordered_map<ll,ll> umll;
#define all(x) x.begin(),x.end()
#define rep(i,k,n) for (int i = k; i < n; ++i)
#define repr(i,k,n) for (int i = n; i>=k; --i)
#define repll(i,k,n) for (ll i = k; i < n; ++i)
#define pb push_back
#define mp make_pair
#define gcd __gcd
#define F first
#define S second
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int INF = 1e9+5;
const int MOD = 1e9+7;
double pi = 2 * acos(0.0);

void solve(){
    int n,k;
    cin>>n>>k;
    vi marked(n,0);
    int max_spread=(k*2)+1;
    vi ans;
    bool f=0;
    if(n>=2*max_spread){
        int l=0;
        int r=2*k;
        ans.pb(k+1);
        rep(i,l,r+1){
            marked[i]=1;
        }
    }
    rep(i,0,n){
        if(marked[i]==0){
            int l=max(0,i-k);
            int r=min(n-1,i+k);
            bool f=0;
            // cout<<l<<' '<<r<<'\n';
            if(marked[l]==0 and marked[r]==0){
                ans.pb(i+1);
                rep(i,l,r+1){
                    marked[i]=1;
                }
            }
        }
    }
    cout<<ans.size()<<'\n';
    rep(i,0,ans.size()){
        cout<<ans[i]<<' ';
    }
}

int main(){
    // #ifndef ONLINE_JUDGE
        // freopen("input.txt", "r", stdin);
        // freopen("output.txt", "w", stdout);
    // #endif
    fastio;
    int t=1;
    // cin>>t;
    while(t--)
        solve();
    return 0;
}


/*Made by Shivam Solanki*/
#include<bits/stdc++.h>
#pragma GCC optimize ("Ofast")
using namespace std;
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define ll long long int
#define endl '\n'
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<pii> vp;
typedef vector<pll> vpll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef set<int> sii;
typedef set<ll> sll;
typedef queue<int> qii;
typedef priority_queue<int> pq;
typedef unordered_map<int,int> umii;
typedef unordered_map<ll,ll> umll;
#define all(x) x.begin(),x.end()
#define rep(i,k,n) for (int i = k; i < n; ++i)
#define repr(i,k,n) for (int i = n; i>=k; --i)
#define repll(i,k,n) for (ll i = k; i < n; ++i)
#define pb push_back
#define mp make_pair
#define gcd __gcd
#define F first
#define S second
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int INF = 1e9+5;
const int MOD = 1e9+7;
double pi = 2 * acos(0.0);

void solve(){
    int n,k;
    cin>>n>>k;
    vi marked(n,0);
    int max_spread=(k*2);
    vi ans;
    if(n>=max_spread){
        int l=0;
        int r=2*k;
        ans.pb(k+1);
        rep(i,l,r+1){
            marked[i]=1;
        }
    }
    rep(i,0,n){
        if(marked[i]==0){
            int l=max(0,i-k);
            int r=min(n-1,i+k);
            bool f=0;
            // cout<<l<<' '<<r<<'\n';
            if(marked[l]==0 and marked[r]==0){
                ans.pb(i+1);
                rep(i,l,r+1){
                    marked[i]=1;
                }
            }
        }
    }
    bool f=0;
    rep(i,0,n){
        if(marked[i]==0){
            f=1;
            break;
        }
    }
    if(f){
        marked=vi(n,0);
        ans.clear();
        rep(i,0,n){
            if(marked[i]==0){
                int l=max(0,i-k);
                int r=min(n-1,i+k);
                bool f=0;
                // cout<<l<<' '<<r<<'\n';
                if(marked[l]==0 and marked[r]==0){
                    ans.pb(i+1);
                    rep(i,l,r+1){
                        marked[i]=1;
                    }
                }
            }
        }
    }
    cout<<ans.size()<<'\n';
    rep(i,0,ans.size()){
        cout<<ans[i]<<' ';
    }
}

int main(){
    // #ifndef ONLINE_JUDGE
        // freopen("input.txt", "r", stdin);
        // freopen("output.txt", "w", stdout);
    // #endif
    fastio;
    int t=1;
    // cin>>t;
    while(t--)
        solve();
    return 0;
}


/*Made by Shivam Solanki*/
#include<bits/stdc++.h>
#pragma GCC optimize ("Ofast")
using namespace std;
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define ll long long int
#define endl '\n'
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<pii> vp;
typedef vector<pll> vpll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef set<int> sii;
typedef set<ll> sll;
typedef queue<int> qii;
typedef priority_queue<int> pq;
typedef unordered_map<int,int> umii;
typedef unordered_map<ll,ll> umll;
#define all(x) x.begin(),x.end()
#define rep(i,k,n) for (int i = k; i < n; ++i)
#define repr(i,k,n) for (int i = n; i>=k; --i)
#define repll(i,k,n) for (ll i = k; i < n; ++i)
#define pb push_back
#define mp make_pair
#define gcd __gcd
#define F first
#define S second
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int INF = 1e9+5;
const int MOD = 1e9+7;
double pi = 2 * acos(0.0);

void solve(){
    int n,k;
    cin>>n>>k;
    vi marked(n,0);
    int max_spread=(k*2)+1;
    vi ans;
    if(n>=max_spread){
        int l=0;
        int r=2*k;
        ans.pb(k+1);
        rep(i,l,r+1){
            marked[i]=1;
        }
    }
    rep(i,0,n){
        if(marked[i]==0){
            int l=max(0,i-k);
            int r=min(n-1,i+k);
            bool f=0;
            // cout<<l<<' '<<r<<'\n';
            if(marked[l]==0 and marked[r]==0){
                ans.pb(i+1);
                rep(i,l,r+1){
                    marked[i]=1;
                }
            }
        }
    }
    bool f=0;
    rep(i,0,n){
        if(marked[i]==0){
            f=1;
            break;
        }
    }
    if(f){
        marked=vi(n,0);
        ans.clear();
        rep(i,0,n){
            if(marked[i]==0){
                int l=max(0,i-k);
                int r=min(n-1,i+k);
                bool f=0;
                // cout<<l<<' '<<r<<'\n';
                if(marked[l]==0 and marked[r]==0){
                    ans.pb(i+1);
                    rep(i,l,r+1){
                        marked[i]=1;
                    }
                }
            }
        }
    }
    cout<<ans.size()<<'\n';
    rep(i,0,ans.size()){
        cout<<ans[i]<<' ';
    }
}

int main(){
    // #ifndef ONLINE_JUDGE
        // freopen("input.txt", "r", stdin);
        // freopen("output.txt", "w", stdout);
    // #endif
    fastio;
    int t=1;
    // cin>>t;
    while(t--)
        solve();
    return 0;
}


/*Made by Shivam Solanki*/
#include<bits/stdc++.h>
#pragma GCC optimize ("Ofast")
using namespace std;
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define ll long long int
#define endl '\n'
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<pii> vp;
typedef vector<pll> vpll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef set<int> sii;
typedef set<ll> sll;
typedef queue<int> qii;
typedef priority_queue<int> pq;
typedef unordered_map<int,int> umii;
typedef unordered_map<ll,ll> umll;
#define all(x) x.begin(),x.end()
#define rep(i,k,n) for (int i = k; i < n; ++i)
#define repr(i,k,n) for (int i = n; i>=k; --i)
#define repll(i,k,n) for (ll i = k; i < n; ++i)
#define pb push_back
#define mp make_pair
#define gcd __gcd
#define F first
#define S second
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int INF = 1e9+5;
const int MOD = 1e9+7;
double pi = 2 * acos(0.0);

void solve(){
    int n,k;
    cin>>n>>k;
    vi marked(n,0);
    int max_spread=(k*2)+1;
    vi ans;
    rep(i,0,n){
        if(marked[i]==0){
            int l=max(0,i-k);
            int r=min(n-1,i+k);
            bool f=0;
            // cout<<l<<' '<<r<<'\n';
            if(marked[l]==0 and marked[r]==0){
                ans.pb(i+1);
                rep(i,l,r+1){
                    marked[i]=1;
                }
            }
        }
    }
    cout<<ans.size()<<'\n';
    rep(i,0,ans.size()){
        cout<<ans[i]<<' ';
    }
}

int main(){
    // #ifndef ONLINE_JUDGE
        // freopen("input.txt", "r", stdin);
        // freopen("output.txt", "w", stdout);
    // #endif
    fastio;
    int t=1;
    // cin>>t;
    while(t--)
        solve();
    return 0;
}