// https://prologin.org/train/2020/qualification/marche_nocturne #include //#include #include #include #include //#include //#include #include using namespace std; int main() { uint32_t n = 0; cin >> n; auto m = vector(n, 0); for(uint32_t i = 0; i < n; i++) cin >> m[i]; //cout << accumulate(m.begin() + 1, m.begin() + 1 + 3, 0) << '\n'; uint32_t prix = 0; cin >> prix; auto mini = *min_element(m.begin(), m.end()); if(mini == prix) { cout << 1 << '\n'; return 0; } for(uint32_t k = 2; k <= n; k++) { for(uint32_t i = 0; i <= n - k; i++) { if(accumulate(m.begin() + i, m.begin() + i + k, 0) == prix) { cout << k << '\n'; return 0; } } } cout << -1 << '\n'; return 0; } // main()