#include <bits/stdc++.h>
using namespace std;
int cnt[101];
int main() {
  int n, k;
  cin >> n >> k;
  string w[101];
  for (int i = 0; i < n; i++) {
    cin >> w[i];
    cnt[(int)(w[i].size())]++;
  }
  string s;
  cin >> s;
  int l = s.size();
  int sum = 0;
  for (int i = 0; i < l; i++) {
    sum += cnt[i];
  }
  sum += 1;
  int j = sum % k;
  int d;
  if (j == 0) {
    d = (sum / k - 1) * 5 + sum;
  } else {
    d = (sum / k) * 5 + sum;
  }
  cout << d << " ";
  int dd;
  int sum1 = sum + cnt[l] - 1;
  int i = sum1 % k;
  if (i == 0) {
    dd = (sum1 / k - 1) * 5 + sum1;
  } else {
    dd = (sum1 / k) * 5 + sum1;
  }
  cout << dd;
}
