#include <bits/stdc++.h>
using namespace std;
int F[100005];
void Build(const string &pattern) {
  int m = pattern.size(), i, j;
  F[0] = F[1] = 0;
  for (i = 2; i <= m; i++) {
    j = F[i - 1];
    for (;;) {
      if (pattern[j] == pattern[i - 1]) {
        F[i] = j + 1;
        break;
      }
      if (j == 0) {
        F[i] = 0;
        break;
      }
      j = F[j];
    }
  }
}
bool mat[100005];
int bef[100005];
void KMP(const string &pattern, const string &text) {
  Build(pattern);
  int n = text.size(), m = pattern.size();
  int i = 0;
  int j = 0;
  for (;;) {
    if (j == n) break;
    if (text[j] == pattern[i]) {
      i++;
      j++;
      if (i == m) {
        mat[j - i + m - 1] = true;
      }
    } else if (i > 0)
      i = F[i];
    else
      j++;
  }
}
const int mod = 1000 * 1000 * 1000 + 7;
char tmp[100005];
string S, T;
int n, m;
int d[100005][2];
int s[100005], ss[100005];
int main() {
  memset(bef, -1, sizeof(bef));
  scanf("%s", tmp);
  n = strlen(tmp), S = tmp;
  scanf("%s", tmp);
  m = strlen(tmp), T = tmp;
  KMP(T, S);
  int start = -1;
  for (int i = 0; i < n; ++i) {
    if (mat[i]) d[i][1] = i - m + 2, start = i;
    s[i] = (i - 1 >= 0 ? s[i - 1] : 1) + d[i][1];
    ss[i] = (i - 1 >= 0 ? ss[i - 1] : 0) + s[i];
    if (mat[i]) break;
  }
  if (start == -1) {
    printf("0");
    return 0;
  }
  int tt = -1;
  for (int i = 0; i < n; ++i) {
    if (mat[i]) bef[i] = tt, tt = i;
  }
  for (int i = start + 1; i < n; ++i) {
    if (mat[i]) {
      if (bef[i] == -1)
        d[i][1] = (d[i][1] + ss[i - m]) % mod;
      else
        d[i][1] = (d[i][1] + (ss[i - m] - ss[bef[i] - m] + mod) % mod) % mod;
    }
    d[i][1] = (d[i][1] + d[i - 1][1]) % mod;
    d[i][0] = (d[i - 1][1] + d[i - 1][0]) % mod;
    s[i] = (s[i - 1] + d[i][1]) % mod;
    ss[i] = (ss[i - 1] + s[i]) % mod;
  }
  printf("%d\n", (d[n - 1][1] + d[n - 1][0]) % mod);
}
