#include <bits/stdc++.h>
using namespace std;
int N, K, ans = 1;
long long sum;
vector<int> pos;
int main() {
  cin >> N >> K;
  for (int i = 1; i <= N; ++i) {
    int x;
    cin >> x;
    if (x >= N - K + 1) sum += x, pos.push_back(i);
  }
  sort(pos.begin(), pos.end());
  for (int i = 1; i < pos.size(); ++i)
    ans = (1ll * ans * (pos[i] - pos[i - 1])) % 998244353;
  cout << sum << " " << ans << '\n';
  return 0;
}
