#include <bits/stdc++.h>
using namespace std;
namespace Base {
const int inf = 0x3f3f3f3f, INF = 0x7fffffff;
const long long infll = 0x3f3f3f3f3f3f3f3fll, INFll = 0x7fffffffffffffffll;
template <typename T>
void read(T &x) {
  x = 0;
  int fh = 1;
  double num = 1.0;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') fh = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  if (ch == '.') {
    ch = getchar();
    while (isdigit(ch)) {
      num /= 10;
      x = x + num * (ch - '0');
      ch = getchar();
    }
  }
  x = x * fh;
}
template <typename T>
void chmax(T &x, T y) {
  x = x < y ? y : x;
}
template <typename T>
void chmin(T &x, T y) {
  x = x > y ? y : x;
}
}  // namespace Base
using namespace Base;
const int N = 2030, P = 998244353;
int n, m, k;
void upd(int &x, int y) {
  x = x + y;
  if (x >= P) x -= P;
}
void solve1() {
  static int f[N];
  f[0] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 0; j <= n; j++)
      if (j + i <= n) upd(f[j + i], f[j]);
  int ans = 0;
  for (int i = 1; i <= n; i++) upd(ans, f[i]);
  cout << ans << endl;
}
void solve2() {
  static int f[N][N];
  f[0][0] = 1;
  m = 2 * (pow(n, 0.5) + 3);
  for (int i = n; i >= 1; i--)
    for (int j = 0; j <= n; j++)
      for (int k = 0; k < m; k++)
        if (j + (k + 1) * i <= n) upd(f[j + (k + 1) * i][k + 1], f[j][k]);
  int ans = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) upd(ans, f[i][j]);
  cout << ans << endl;
}
int ans = 0, now[N], nxt[N], num[N];
bool check(int len) {
  int j = k;
  for (int i = 1; i <= len; i++) now[i] = num[len - i + 1];
  while (j > 2) {
    int cnt = 0;
    for (int i = len; i >= 1; i--)
      for (int j = 1; j <= now[i]; j++) {
        nxt[++cnt] = len - i + 1;
        if (cnt > n) return false;
      }
    for (int i = 1; i <= cnt; i++) now[i] = nxt[i];
    len = cnt;
    j--;
  }
  int sum = 0;
  for (int i = 1; i <= len; i++) {
    sum = sum + (len - i + 1) * now[i];
    if (sum > n) return false;
  }
  return true;
}
void dfs(int k) {
  int L = num[k - 1];
  if (k == 1) L = n;
  for (int i = 1; i <= L; i++) {
    num[k] = i;
    if (!check(k)) return;
    ans++;
    dfs(k + 1);
  }
}
void solve3() {
  dfs(1);
  cout << ans << endl;
}
int main() {
  read(n);
  read(k);
  if (k == 1) solve1();
  if (k == 2) solve2();
  if (k > 2) solve3();
  return 0;
}
