#include <bits/stdc++.h>
using namespace std;
long long m = 998244353;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long n, k, temp = 0, ans = 1;
  cin >> n >> k;
  vector<long long> v;
  for (int x = 0; x < n; x++) {
    int a;
    cin >> a;
    if (a >= n - k + 1) {
      temp += a;
      v.push_back(x);
    }
  }
  for (int x = 0; x < v.size() - 1; x++) {
    ans = ans * abs(v[x + 1] - v[x]);
    ans = ans % m;
  }
  cout << temp << " " << ans;
  return 0;
}
