#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
int main() {
  int n, k;
  cin >> n >> k;
  int p[n];
  for (int &i : p) cin >> i;
  long long sum = 0;
  vector<int> v;
  for (int i = 0; i < n; i++)
    if (p[i] > n - k) {
      sum += p[i];
      v.push_back(i);
    }
  long long ans = 1;
  for (int i = 0; i < int(v.size()) - 1; i++)
    ans = ans * (v[i + 1] - v[i]) % mod;
  cout << sum << ' ' << ans << "\n";
  return 0;
}
