#include <bits/stdc++.h>
long long dp[3010][210];
int n, k, i, j, m, l, len;
int a[210], b[210], c[210];
bool link[210][210];
long long ans;
int main() {
  scanf("%d%d", &n, &l);
  len = 200;
  for (i = 1, m = 0; i <= n; i++) {
    m++;
    scanf("%d%d", &a[m], &b[m]);
    c[m] = i;
    if (a[m] != b[m]) {
      m++;
      a[m] = b[m - 1];
      b[m] = a[m - 1];
      c[m] = i;
    }
    if (a[m] < len) len = a[m];
    if (b[m] < len) len = b[m];
  }
  for (i = 1; i <= m; i++)
    for (j = 1; j <= m; j++)
      if ((b[i] == a[j]) && (c[j] != c[i]))
        link[i][j] = 1;
      else
        link[i][j] = 0;
  memset(dp, 0, sizeof(dp));
  for (; len <= l; len++)
    for (i = 1; i <= m; i++)
      if (a[i] == len)
        dp[len][i] = 1;
      else if (a[i] < len) {
        for (j = 1; j <= m; j++)
          if (link[j][i]) dp[len][i] += dp[len - a[i]][j];
        dp[len][i] %= 1000000007;
      }
  ans = 0;
  for (i = 1; i <= m; i++) ans += dp[l][i];
  ans %= 1000000007;
  printf("%I64d\n", ans);
}
