#include <bits/stdc++.h>   using namespace std;   long long mod = 1000000007;   int main() {     long long dp[3001][100][2] = {0};     long long n, l;     cin >> n >> l;     vector<long long> a(n), b(n);     for (long long i = 0; i < n; ++i) {       cin >> a[i] >> b[i];       dp[a[i]][i][0] = 1;       dp[b[i]][i][1] = 1;     }     for (long long i = 1; i <= l; ++i) {       for (long long j = 0; j < n; ++j) {         for (long long k = 0; k < n; ++k) {           if (j != k) {             if (a[j] == b[k] && i - a[j] >= 0) {               dp[i][j][0] = (dp[i][j][0] + dp[i - a[j]][k][0]) % mod;             }             if (a[j] == a[k] && a[k] != b[k] && i - a[j] >= 0) {               dp[i][j][0] = (dp[i][j][0] + dp[i - a[j]][k][1]) % mod;             }             if (b[j] == b[k] && a[j] != b[j] && i - b[j] >= 0) {               dp[i][j][1] = (dp[i][j][1] + dp[i - b[j]][k][0]) % mod;             }             if (b[j] == a[k] && a[j] != b[j] && a[k] != b[k] && i - b[j] >= 0) {               dp[i][j][1] = (dp[i][j][1] + dp[i - b[j]][k][1]) % mod;             }           }         }       }     }     long long res = 0;     for (long long i = 0; i < n; ++i) {       res = (res + dp[l][i][0]) % mod;       if (a[i] != b[i]) res = (res + dp[l][i][1]) % mod;     }     cout << res << endl;     return 0;   }   