#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, k;
  cin >> n >> k;
  int a[n + 1];
  int b[n + 1];
  a[0] = 0;
  for (int i = 1; i < n + 1; i++) {
    a[i] = a[i - 1] + i;
  }
  b[0] = n;
  for (int i = 1; i < n + 1; i++) {
    b[i] = b[i - 1] + n - i;
  }
  for (int i = 0; i < n + 1; i++) {
    cout << a[i] << " ";
  }
  cout << '\n';
  for (int i = 0; i < n + 1; i++) {
    cout << b[i] << " ";
  }
  long long int sum = 0;
  for (int i = k - 1; i <= n + 1; i++) {
    sum = sum + b[i] - a[i] + 1;
  }
  cout << '\n' << sum;
  return 0;
}
