#include <bits/stdc++.h>
using namespace std;
char a[100005];
char c[100005];
int nex[100005];
int dp[100005], dp1[100005];
const int mod = 1000000007;
int s[100005], s1[100005];
int main() {
  int i, j, m;
  cin >> a;
  cin >> c;
  int n;
  n = strlen(a);
  m = strlen(c);
  memset(nex, -1, sizeof(nex));
  i = 0;
  j = -1;
  nex[0] = -1;
  while (i < m) {
    if (j == -1 || c[i] == c[j]) {
      i++;
      j++;
      nex[i] = j;
    } else {
      j = nex[j];
    }
  }
  memset(dp, -1, sizeof(dp));
  j = 0;
  for (i = 0; i < n; i++) {
    if (a[i] == c[j]) {
      j++;
      if (j == m) {
        dp[i] = i - m + 1;
        j = nex[j];
        if (j == -1) j++;
      }
    } else {
      while (j != -1 && a[i] != c[j]) j = nex[j];
      j++;
      if (j == m) {
        dp[i] = i - m + 1;
        j = nex[j];
      }
    }
    if (i != 0) dp[i] = max(dp[i], dp[i - 1]);
  }
  for (i = 0; i < n; i++) {
    if (i != 0) {
      s[i] = s[i - 1];
      s1[i] = s1[i - 1];
    }
    if (dp[i] != -1) {
      dp1[i] = dp[i] + 1;
      if (dp[i] != 0) dp1[i] += s1[dp[i] - 1];
      dp1[i] %= mod;
    }
    s[i] += dp1[i];
    s[i] %= mod;
    s1[i] += s[i];
    s1[i] %= mod;
  }
  printf("%d\n", s[n - 1]);
  return 0;
}
