#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int n, l;
int len[109], wd[109];
int dp[3002][103][2];
int solve(int sum, int last, int typ) {
  if (sum == l) return 1;
  if (sum > l) return 0;
  int &ret = dp[sum][last][typ];
  if (ret != (-1)) return ret;
  ret = 0;
  for (int i = 1; i <= n; i++) {
    if (i == last) continue;
    if (last == 0) {
      if (len[i] != wd[i]) {
        ret += solve(sum + len[i], i, 0), ret = ret % mod;
        ret += solve(sum + wd[i], i, 1), ret = ret % mod;
      } else {
        ret += solve(sum + len[i], i, 0);
        ret = ret % mod;
      }
    } else {
      int pre;
      if (typ == 0) {
        pre = wd[last];
      } else if (typ == 1) {
        pre = len[last];
      }
      if (len[i] != wd[i]) {
        if (pre == len[i]) ret += solve(sum + len[i], i, 0), ret = ret % mod;
        if (pre == wd[i]) ret += solve(sum + wd[i], i, 1), ret = ret % mod;
      } else {
        if (pre == len[i]) ret += solve(sum + len[i], i, 0), ret = ret % mod;
      }
    }
  }
  if (ret < 0) ret += mod;
  ret = ret % mod;
  return ret;
}
int main() {
  scanf("%d%d", &n, &l);
  memset(dp, -1, sizeof dp);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &len[i], &wd[i]);
  }
  int ses = solve(0, 0, 0);
  printf("%d\n", ses);
  return 0;
}
