#include <bits/stdc++.h>   using namespace std;   int a[] = {2, 7, 2, 3, 3, 4, 2, 5, 1, 2};   const int Q = 1e9 + 7;   int main() {     string s, t;     cin >> s >> t;     vector<int> p(t.length());     for (int i = 1; i < t.length(); ++i) {       int k = p[i - 1];       while (k > 0) {         if (t[k] == t[i]) {           p[i] = k + 1;           break;         }         k = p[k - 1];       }       if (!p[i] && t[i] == t[0]) p[i] = 1;     }     vector<int> x(s.length());     if (s[0] == t[0]) x[0] = 1;     for (int i = 1; i < s.length(); ++i) {       int k = x[i - 1];       if (k == t.length()) k = p[k - 1];       while (k > 0) {         if (s[i] == t[k]) {           x[i] = k + 1;           break;         }         k = p[k - 1];       }       if (!x[i] && s[i] == t[0]) x[i] = 1;     }     vector<int> sum(s.length() + 1), r(s.length() + 1), h(s.length() + 1);     sum[0] = 0;     h[0] = 0;     for (int i = 0; i < s.length(); ++i) {       if (x[i] == t.length()) {         r[i + 1] = (h[i - t.length() + 1] + i - t.length() + 2) % Q;       } else {         r[i + 1] = r[i];       }       sum[i + 1] = (sum[i] + r[i + 1]) % Q;       h[i + 1] = (h[i] + sum[i + 1]) % Q;     }     cout << sum[s.length()];     return 0;   }   