#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  string s;
  map<int, int> mp;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> s;
    ++mp[s.size()];
  }
  cin >> s;
  int key = s.size();
  int mini = 0, maxs = 0;
  int temp = k;
  for (map<int, int>::iterator iter = mp.begin(); iter != mp.end(); iter++) {
    if (iter->first < key) {
      for (int i = 0; i < iter->second; i++) {
        if (temp == 0) {
          temp = k;
          mini += 5, maxs += 5;
        }
        mini += 1, maxs += 1;
        --temp;
      }
    }
    if (iter->first == key) {
      if (temp == 0)
        mini += 6;
      else
        mini += 1;
      for (int i = 0; i < iter->second; i++) {
        if (temp == 0) {
          maxs += 5;
          temp = k;
        }
        maxs += 1;
        --temp;
      }
    }
  }
  cout << mini << " " << maxs << endl;
  return 0;
}
