#include #include #include #include #include using namespace std; const long long MOD = 1e9 + 4; long long n, k; void solve1() { vector f(k); int i = 0, a; int val = 0; for (; i < n; i++) { cin >> a; f[i] = a; val += a; } int j = 0; for (; i < k; i++, j++) { f[i] = val; val += f[i] - f[j]; } long long sum = 0; for (int i = 0; i < k; i++) { sum = (sum + f[i]) % MOD; } cout << f[k - 1] % MOD << " " << sum << endl; return ; } void solve2() { } int main() { cin >> n >> k; if (k <= 1e6) { solve1(); } else { solve2(); } return 0; }