#include <bits/stdc++.h>
using namespace std;
int const N = 2020, md = 998244353;
int dp[N + 1][N + 1], n, k, an;
void ad(int &x, int y) {
  if ((x += y) >= md) x -= md;
}
int sq(int x) { return x * (x + 1) >> 1; }
int gtsm(vector<int> const &v) {
  int sm = 0;
  for (int i = 1; i < (int)(v.size() + 1); ++i) sm += i * v[v.size() - i];
  return sm;
}
void pr(vector<int> const &v) {
  for (int t : v) printf("%d ", t);
  printf("\n");
}
vector<int> v, v1, v2;
bool ok() {
  v1 = v;
  for (int i = 2; i < (int)(k); ++i) {
    if (gtsm(v1) > n) return false;
    v2.clear();
    for (int i = 1; i < (int)(v1.size() + 1); ++i)
      for (int j = 0; j < (int)(v1[v1.size() - i]); ++j) v2.push_back(i);
    swap(v1, v2);
  }
  return gtsm(v1) <= n;
}
void go(int sm = 0, int lst = 1) {
  if (!ok()) return;
  if (sm) ++an;
  for (int i = lst; i < (int)(63 - sm + 1); ++i) {
    v.push_back(i);
    go(sm + i, i);
    v.pop_back();
  }
}
int main() {
  scanf("%d%d", &n, &k);
  if (k == 1) {
    dp[0][0] = 1;
    for (int i = 0; i < (int)(N + 1); ++i)
      for (int j = 1; j < (int)(N + 1); ++j) {
        ad(dp[i][j], dp[i][j - 1]);
        if (i + j <= N) ad(dp[i + j][j], dp[i][j]);
      }
    for (int i = 1; i < (int)(n + 1); ++i) ad(an, dp[i][n]);
  } else if (k == 2) {
    dp[0][0] = 1;
    for (int i = 0; i < (int)(n + 1); ++i)
      for (int j = 0; j < (int)(n + 1); ++j) {
        int t = sq(i);
        if (i && j + t <= n) ad(dp[i][j + t], dp[i][j]);
        if (j + i + 1 <= n) ad(dp[i + 1][j + i + 1], dp[i][j]);
      }
    for (int i = 1; i < (int)(n + 1); ++i)
      for (int j = 1; j < (int)(n + 1); ++j) ad(an, dp[i][j]);
  } else
    go();
  printf("%d\n", an);
}
