#include <bits/stdc++.h>
using namespace std;
using namespace std;
bool sortinrev(const pair<long long int, long long int> &a,
               const pair<long long int, long long int> &b) {
  return (a.first > b.first);
}
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
vector<long long int> prefix_function(string s, string t) {
  string p = t + '#' + s;
  long long int n = (long long int)p.length();
  vector<long long int> pi(n);
  for (long long int i = 1; i < n; i++) {
    long long int j = pi[i - 1];
    while (j > 0 && p[i] != p[j]) j = pi[j - 1];
    if (p[i] == p[j]) j++;
    pi[i] = j;
  }
  vector<long long int> ret;
  long long int tmp = t.size();
  for (long long int i = 0; i < s.size(); i++) {
    if (pi[i + t.size() + 1] == tmp)
      ret.push_back(1);
    else
      ret.push_back(0);
  }
  return ret;
}
int main() {
  string s, t;
  cin >> s >> t;
  vector<long long int> sub = prefix_function(s, t);
  long long int n1 = s.size();
  long long int a[n1], q1[n1], q2[n1];
  long long int n = t.size();
  memset(a, 0, sizeof(a));
  memset(q1, 0, sizeof(q1));
  memset(q2, 0, sizeof(q2));
  for (long long int i = 0; i < n1; i++) {
    if (i == 0) {
      if (sub[i] == 0) continue;
      a[i] = 1;
      q1[i] = 1;
      q2[i] = 1;
    } else {
      if (sub[i]) {
        a[i] = i - n + 2;
        if (i >= n) a[i] += q2[i - n];
      } else {
        a[i] = a[i - 1];
      }
      q1[i] = a[i] + q1[i - 1];
      q2[i] = q1[i] + q2[i - 1];
      a[i] %= 1000000007ll;
      q1[i] %= 1000000007ll;
      q2[i] %= 1000000007ll;
    }
  }
  cout << q1[n1 - 1] << " " << endl;
}
