#include <bits/stdc++.h>
using namespace std;
int dp[3001][101][101];
int total[3001][101];
int main() {
  int n, l;
  cin >> n >> l;
  pair<int, int> type[n];
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    type[i] = make_pair(a, b);
  }
  for (int i = 0; i <= 100; i++) total[0][i] = 1;
  for (int i = 1; i <= l; i++) {
    for (int j = 0; j < n; j++) {
      int a = type[j].first;
      int b = type[j].second;
      if (i - a >= 0) {
        dp[i][j][b] = total[i - a][a] - dp[i - a][j][a];
        if (dp[i][j][b] < 0) dp[i][j][b] += 1000000007;
        total[i][b] = (total[i][b] + dp[i][j][b]) % 1000000007;
      }
      if (i - b >= 0 && a != b) {
        dp[i][j][a] = total[i - b][b] - dp[i - b][j][b];
        if (dp[i][j][a] < 0) dp[i][j][a] += 1000000007;
        total[i][a] = (total[i][a] + dp[i][j][a]) % 1000000007;
      }
    }
  }
  int ans = 0;
  for (int i = 0; i <= 100; i++) {
    ans = (ans + total[l][i]) % 1000000007;
  }
  cout << ans << endl;
  return 0;
}
