#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int n, l, a[105], b[105];
int dp[105][3005][2];
int f(int last, int lleft, int ori) {
  if (lleft < 0) return 0;
  if (lleft == 0) return 1;
  int &ret = dp[last][lleft][ori];
  if (ret != -1) return ret;
  ret = 0;
  for (int i = 0; i < n; ++i)
    if (i != last) {
      if (ori == 0) {
        if (a[i] == b[last]) ret = (ret + f(i, lleft - a[i], 0)) % MOD;
        if (a[i] != b[i] && b[i] == b[last])
          ret = (ret + f(i, lleft - b[i], 1)) % MOD;
      } else {
        if (a[i] == a[last]) ret = (ret + f(i, lleft - a[i], 0)) % MOD;
        if (a[i] != b[i] && b[i] == a[last])
          ret = (ret + f(i, lleft - b[i], 1)) % MOD;
      }
    }
  return ret;
}
int main() {
  scanf("%d%d", &n, &l);
  for (int i = 0; i < n; ++i) scanf("%d%d", &a[i], &b[i]);
  memset(dp, -1, sizeof(dp));
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    ans = (ans + f(i, l - a[i], 0)) % MOD;
    if (a[i] != b[i]) ans = (ans + f(i, l - b[i], 1)) % MOD;
  }
  printf("%d\n", ans);
  return 0;
}
