#include <bits/stdc++.h>
using namespace std;
long long ar[200005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  vector<long long> vc;
  long long pop_back = -1, sum = 0, ans = 0;
  for (int i = 1; i <= n; i++) {
    cin >> ar[i];
    if (n - m + 1 <= ar[i]) {
      sum += ar[i];
      if (pop_back == -1)
        pop_back = i, ans = 1;
      else
        ans = (ans * (i - pop_back)) % 998244353, pop_back = i;
    }
  }
  cout << sum << " " << ans << endl;
  return 0;
}
