#include <bits/stdc++.h>
using namespace std;
const int maxN = 1e6;
unsigned long long h[maxN], pw[maxN];
int b = 29;
string s, z;
const long long MOD = 1e9 + 7;
bool st[maxN], fn[maxN];
int dp[maxN], dpt[maxN];
int last = -1;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> s;
  for (int i = 0; i < maxN; i++)
    if (i == 0)
      pw[i] = 1;
    else
      pw[i] = b * pw[i - 1];
  for (int i = 0; i < s.size(); i++)
    if (i == 0)
      h[0] = s[i] - 'a' + 1;
    else
      h[i] = h[i - 1] * b + s[i] - 'a' + 1;
  cin >> z;
  long long cur;
  for (int i = 0; i < z.size(); i++)
    if (i == 0)
      cur = z[i] - 'a' + 1;
    else
      cur = cur * b + z[i] - 'a' + 1;
  for (int i = 0; i + z.size() - 1 < s.size(); i++) {
    long long now;
    if (i == 0)
      now = h[i + z.size() - 1];
    else
      now = h[i + z.size() - 1] - pw[z.size()] * h[i - 1];
    if (now == cur) {
      st[i] = fn[i + z.size() - 1] = 1;
    }
  }
  if (s[0] == z[0] and z.size() == 1) {
    dp[0] = dpt[0] = 1;
    last = 0;
  } else
    dp[0] = 0;
  for (int i = 1; i < s.size(); i++) {
    if (fn[i] == 0) {
      if (last == -1)
        dp[i] = 0;
      else
        dp[i] = (dp[i - 1] + dpt[last]) % MOD;
    } else {
      if (last == -1) {
        dp[i] = dpt[i] = i - z.size() + 2;
        last = i;
      } else {
        int j = i - z.size() + 1;
        while (j >= 0) {
          if (j == i - z.size() + 1)
            dpt[i] = (dpt[i] + dp[j - 1] + 1) % MOD;
          else if (!st[j])
            dpt[i] = (dpt[i] + dp[j - 1] + 1) % MOD;
          else {
            dpt[i] = (dpt[i] + dpt[j + z.size() - 1]) % MOD;
            break;
          }
          j--;
        }
        dp[i] = (dp[i - 1] + dpt[i]) % MOD;
        last = i;
      }
    }
  }
  cout << dp[s.size() - 1] << endl;
  return 0;
}
