#include <bits/stdc++.h>
using namespace std;
int read() {
  char c = getchar();
  while (c < '0' || c > '9') c = getchar();
  int x = 0;
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x;
}
const int mod = 1000000007;
long long pw[300002];
long long dp[505][505], coff[505];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  if (!m) return puts("1"), 0;
  pw[0] = 1;
  for (int i = 1; i <= n * n; i++) pw[i] = pw[i - 1] * 2 % mod;
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++)
      coff[j] = pw[(j - i - 1) * i] * (pw[j] - pw[i]) % mod;
    dp[i][1] = (dp[i][1] + pw[i] - 1) % mod;
    for (int j = 1; j <= i; j++)
      if (dp[i][j]) {
        for (int k = i + 1; k <= n; k++)
          dp[k][j + 1] = (dp[k][j + 1] + dp[i][j] * coff[k]) % mod;
      }
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) ans = (ans + dp[i][m] * pw[(n - i) * i]) % mod;
  printf("%lld\n", (ans % mod + mod) % mod);
}
