#include <bits/stdc++.h>
using namespace std;
const int maxn = 500 + 10, mod = 1e9 + 7;
int pw[maxn * maxn], dp[maxn][maxn];
inline int ad(int x, int y) { return (x + y) % mod; }
inline int mu(int x, int y) { return 1LL * x * y % mod; }
void prep(int N) {
  for (int i = 0; i < N * N; i++) pw[i] = (!i ? 1 : ad(pw[i - 1], pw[i - 1]));
  dp[0][0] = dp[1][1] = dp[0][1] = 1;
  for (int i = 0; i <= N; i++) {
    for (int n = max(i, 2); n <= N; n++) {
      if (!i) {
        dp[i][n] = 1;
        continue;
      }
      int ans = 0;
      for (int r = 0; r < n; r++) {
        int t1 = (r + 1) * (n - r - 1);
        int t2 = ad(pw[r + 1], mod - 1);
        int t3 = mu(pw[t1], t2);
        ans = ad(ans, mu(t3, dp[i - 1][n - r - 1]));
      }
      dp[i][n] = ans;
    }
  }
}
int main() {
  int n, k;
  cin >> n >> k;
  prep(n);
  cout << dp[k][n] << endl;
}
