#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:100000000000000")
using namespace std;
int dp[100005][2][2];
string P, T;
int b[100005], n, m;
void kmpPreprocess() {
  int i = 0, j = -1;
  b[0] = -1;
  while (i < m) {
    while (j >= 0 && P[i] != P[j]) j = b[j];
    i++;
    j++;
    b[i] = j;
  }
}
vector<int> v;
void kmpSearch() {
  int i = 0, j = 0;
  while (i < n) {
    while (j >= 0 && T[i] != P[j]) j = b[j];
    i++;
    j++;
    if (j == m) {
      v.push_back(i - j);
      j = b[j];
    }
  }
}
int nx[100005];
long long rec(int p, bool x, bool y) {
  if (p == n) return y;
  if (~dp[p][x][y]) return dp[p][x][y];
  long long ret = rec(p + 1, 0, y);
  if (~nx[p]) {
    ret += rec(nx[p] + P.size(), 1, 1);
    ret %= 1000000007;
  }
  if (x) {
    ret += rec(p + 1, 1, y);
    ret %= 1000000007;
  }
  return dp[p][x][y] = ret;
}
int main() {
  cin >> T >> P;
  n = T.size(), m = P.size();
  kmpPreprocess();
  kmpSearch();
  sort((v).begin(), (v).end());
  memset((nx), (-1), sizeof(nx));
  int j = int(v.size()) - 1, bef = -1;
  for (int i = n - 1; i >= 0; i--) {
    if (j >= 0 && v[j] >= i) bef = v[j], j--;
    nx[i] = bef;
  }
  memset((dp), (-1), sizeof(dp));
  long long ans = rec(0, 0, 0);
  cout << ans << endl;
  return 0;
}
