#include <bits/stdc++.h>
using ll = long long;
using ull = unsigned long long;
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  vector<int> a(105);
  string s;
  for (int i = 0; i < n; i++) {
    cin >> s;
    a[(int)s.size()]++;
  }
  cin >> s;
  int p = (int)s.size();
  int sum = 0;
  for (int i = 1; i < p; i++) sum += a[i];
  int ans = sum + 1 + (sum / k) * 5;
  cout << ans << " ";
  int cnt = sum % k;
  ans--;
  for (int i = 0; i < a[p]; i++) {
    cnt++;
    ans++;
    if (i != a[p] - 1) {
      if (cnt >= k) {
        ans += 5;
        cnt = 0;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
