#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000007;
const long long INFLL = 1000000000000000007;
const long long MOD = 998244353;
bool comp(long long a, long long b) { return a > b; }
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n, k;
  cin >> n >> k;
  vector<long long> v;
  for (int i = 0; i < n; i++) {
    long long x;
    cin >> x;
    v.push_back(x);
  }
  long long ans = 0, ans1 = 1, licz = -INFLL;
  for (int i = 0; i < n; i++) {
    if (v[i] <= n - k)
      licz++;
    else {
      if (licz > 0) ans1 *= (licz + 1);
      ans1 %= MOD;
      ans += v[i];
      licz = 0;
    }
  }
  cout << ans << " " << ans1;
  return 0;
}
