#include <bits/stdc++.h>   using namespace std;   void input(long long int n, long long int a[]) {     for (long long int i = 0; i < n; ++i) cin >> a[i];   }   long long int bin_expo(long long int A, long long int B, long long int M) {     long long int result = 1ll;     while (B > 0) {       if (B % 2 == 1) {         result = (result * A) % M;       }       A = (A * A) % M;       B = B / 2;     }     return result;   }   long long int gcd(long long int a, long long int b) {     if (b == 0) return a;     return gcd(b, a % b);   }   long long int lcm(long long int a, long long int b) {     return (a * b) / gcd(a, b);   }   long long int n, l;   long long int a[101], b[101];   long long int dp[4001][200][3];   long long int solve(long long int left, long long int prev,                       long long int flag) {     if (left < 0) return 0LL;     if (left == 0) return 1LL;     if (dp[left][prev][flag] != -1) return dp[left][prev][flag];     long long int res = 0;     if (prev == -1) {       for (long long int i = 0; i < n; ++i) {         res += solve(left - a[i], i, 2);         if (a[i] != b[i]) res += solve(left - b[i], i, 1);         res %= 1000000007;       }     } else {       for (long long int i = 0; i < n; ++i) {         if (i != prev) {           long long int cur;           if (flag == 1) cur = a[prev];           if (flag == 2) cur = b[prev];           if (a[i] == cur)             res += solve(left - a[i], i, 2);           else if (b[i] == cur)             res += solve(left - b[i], i, 1);           res %= 1000000007;         }       }     }     return dp[left][prev][flag] = res % 1000000007;   }   int main() {     memset(dp, -1, sizeof(dp));     cin >> n >> l;     for (long long int i = 0; i < n; ++i) cin >> a[i] >> b[i];     cout << solve(l, -1, 0) << endl;     return 0;   }   