#include <bits/stdc++.h>
using namespace std;
const int N = 1000000 + 7;
const int M = 32;
const long long base = 1e18;
const int mod = 999983;
const int inf = 1e9 + 7;
const double pi = acos(-1);
const int maxn = N * 2;
const double PI = acos(-1);
const double ep = 1e-9;
int n, k;
long long dp[507][507];
long long lt2[507];
long long pw2(int x) {
  if (x == 0) return 1;
  if (x & 1) return pw2(x - 1) * 2 % inf;
  long long tmp = pw2(x / 2);
  return tmp * tmp % inf;
}
void solve() {
  cin >> n >> k;
  dp[0][0] = 1;
  long long ans = 0;
  lt2[0] = 1;
  for (int i = (1); i < (507); i++) lt2[i] = lt2[i - 1] * 2 % inf;
  for (int i = (1); i < (n + 1); i++) {
    for (int t = (1); t < (k + 1); t++) {
      dp[i][t] = 0;
      for (int j = (0); j < (i); j++) {
        dp[i][t] = (dp[i][t] + dp[j][t - 1] * (lt2[i - j] - 1 + inf)) % inf;
      }
      for (int j = (0); j < (i); j++) {
        dp[j][t] = (dp[j][t] * lt2[j] % inf);
      }
    }
  }
  for (int i = (0); i < (n + 1); i++) ans = (ans + dp[i][k]) % inf;
  cout << ans;
}
int main() {
  int T = 1;
  for (int i = (1); i < (T + 1); i++) {
    solve();
  }
}

### Prompt

Construct a CPP code solution to the problem outlined:

Let's assume that set S consists of m distinct intervals [l1, r1], [l2, r2], ..., [lm, rm] (1 ≤ li ≤ ri ≤ n; li, ri are integers).

Let's assume that f(S) is the maximum number of intervals that you can choose from the set S, such that every two of them do not intersect. We assume that two intervals, [l1, r1] and [l2, r2], intersect if there is an integer x, which meets two inequalities: l1 ≤ x ≤ r1 and l2 ≤ x ≤ r2.

Sereja wonders, how many sets S are there, such that f(S) = k? Count this number modulo 1000000007 (109 + 7).

Input

The first line contains integers n, k (1 ≤ n ≤ 500; 0 ≤ k ≤ 500).

Output

In a single line, print the answer to the problem modulo 1000000007 (109 + 7).

Examples

Input

3 1


Output

23


Input

3 2


Output

32


Input

2 0


Output

1


Input

2 2


Output

2

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int N = 1000000 + 7;
const int M = 32;
const long long base = 1e18;
const int mod = 999983;
const int inf = 1e9 + 7;
const double pi = acos(-1);
const int maxn = N * 2;
const double PI = acos(-1);
const double ep = 1e-9;
int n, k;
long long dp[507][507];
long long lt2[507];
long long pw2(int x) {
  if (x == 0) return 1;
  if (x & 1) return pw2(x - 1) * 2 % inf;
  long long tmp = pw2(x / 2);
  return tmp * tmp % inf;
}
void solve() {
  cin >> n >> k;
  dp[0][0] = 1;
  long long ans = 0;
  lt2[0] = 1;
  for (int i = (1); i < (507); i++) lt2[i] = lt2[i - 1] * 2 % inf;
  for (int i = (1); i < (n + 1); i++) {
    for (int t = (1); t < (k + 1); t++) {
      dp[i][t] = 0;
      for (int j = (0); j < (i); j++) {
        dp[i][t] = (dp[i][t] + dp[j][t - 1] * (lt2[i - j] - 1 + inf)) % inf;
      }
      for (int j = (0); j < (i); j++) {
        dp[j][t] = (dp[j][t] * lt2[j] % inf);
      }
    }
  }
  for (int i = (0); i < (n + 1); i++) ans = (ans + dp[i][k]) % inf;
  cout << ans;
}
int main() {
  int T = 1;
  for (int i = (1); i < (T + 1); i++) {
    solve();
  }
}

```