#include <bits/stdc++.h>
using namespace std;
long long pwr(long long base, long long p, long long mod = (1000000007LL)) {
  long long ans = 1;
  while (p) {
    if (p & 1) ans = (ans * base) % mod;
    base = (base * base) % mod;
    p /= 2;
  }
  return ans;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
long long invMod(long long val) { return pwr(val, (1000000007LL) - 2); }
string str, pat;
int len1, len2, lps[100005], nextRight[100005];
bool pattern_end[100005];
long long DP[100005], cumSum[100005];
void KMP();
int main() {
  ios_base::sync_with_stdio(0);
  cin >> str >> pat;
  len1 = str.length();
  len2 = pat.length();
  KMP();
  int last = len1;
  for (int i = len1 - 1; i >= 0; i--) {
    if (pattern_end[i + len2 - 1]) last = i + len2 - 1;
    nextRight[i] = last;
  }
  DP[len1] = cumSum[len1] = 1;
  for (int i = len1 - 1; i >= 0; i--) {
    DP[i] = DP[i + 1];
    if (nextRight[i] < len1) DP[i] += cumSum[nextRight[i] + 1];
    DP[i] %= (1000000007LL);
    cumSum[i] = (cumSum[i + 1] + DP[i]) % (1000000007LL);
  }
  long long ans = (DP[0] - 1) % (1000000007LL);
  if (ans < 0) ans += (1000000007LL);
  cout << ans;
  return 0;
}
void KMP() {
  lps[0] = 0;
  for (int i = 1; i < len2; i++) {
    int j = lps[i - 1];
    while (j > 0 && pat[i] != pat[j]) j = lps[j - 1];
    if (pat[j] == pat[i]) j++;
    lps[i] = j;
  }
  int i = 0, j = 0;
  while (i < len1) {
    if (str[i] == pat[j]) {
      i++;
      j++;
    }
    if (j == len2) {
      pattern_end[i - 1] = true;
      j = lps[j - 1];
    } else if (i < len1 && str[i] != pat[j]) {
      if (j != 0)
        j = lps[j - 1];
      else
        i++;
    }
  }
}
