This morning, Roman woke up and opened the browser with n opened tabs numbered from 1 to n. There are two kinds of tabs: those with the information required for the test and those with social network sites. Roman decided that there are too many tabs open so he wants to close some of them.

He decided to accomplish this by closing every k-th (2 ≤ k ≤ n - 1) tab. Only then he will decide whether he wants to study for the test or to chat on the social networks. Formally, Roman will choose one tab (let its number be b) and then close all tabs with numbers c = b + i ⋅ k that satisfy the following condition: 1 ≤ c ≤ n and i is an integer (it may be positive, negative or zero).

For example, if k = 3, n = 14 and Roman chooses b = 8, then he will close tabs with numbers 2, 5, 8, 11 and 14.

After closing the tabs Roman will calculate the amount of remaining tabs with the information for the test (let's denote it e) and the amount of remaining social network tabs (s). Help Roman to calculate the maximal absolute value of the difference of those values |e - s| so that it would be easy to decide what to do next.

Input

The first line contains two integers n and k (2 ≤ k < n ≤ 100) — the amount of tabs opened currently and the distance between the tabs closed.

The second line consists of n integers, each of them equal either to 1 or to -1. The i-th integer denotes the type of the i-th tab: if it is equal to 1, this tab contains information for the test, and if it is equal to -1, it's a social network tab.

Output

Output a single integer — the maximum absolute difference between the amounts of remaining tabs of different types |e - s|.

Examples

Input


4 2
1 1 -1 1


Output


2


Input


14 3
-1 1 -1 -1 1 -1 -1 1 -1 -1 1 -1 -1 1


Output


9

Note

In the first example we can choose b = 1 or b = 3. We will delete then one tab of each type and the remaining tabs are then all contain test information. Thus, e = 2 and s = 0 and |e - s| = 2.

In the second example, on the contrary, we can leave opened only tabs that have social networks opened in them.

import java.io.*;
import java.util.*;
import javax.print.attribute.standard.Finishings;

import java.math.*;

public class Exam {
	static final Random random = new Random();
	static PrintWriter out = new PrintWriter((System.out));
	static Reader sc = new Reader();

	public static void main(String args[]) throws IOException {
//		int t = sc.nextInt();
//		while (t-- > 0) {

//        	CODE START FROM HERE
		int n = sc.nextInt();
		int k = sc.nextInt();
		int res = 0;

		int num[] = new int[n];
		int m[] = new int[n];
		read(num);
		for (int i = 0; i < k; i++) {
			m = num.clone();
			for (int j = i; j < n; j += k) {

				m[j] = 0;
			}

			res = Math.max(res, count(m));
		}
		System.out.println(res);
	}

	static int count(int[] m) {

		int c1 = 0;
		int c2 = 0;
		for (int i = 0; i < m.length; i++) {

			if (m[i] == 1)
				c1++;

			if (m[i] == -1)
				c2++;
		}

		return Math.abs(c1 - c2);

	}

	// Fast Input Output
	static class Reader {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		public String next() {
			while (!st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public String nextLine() {
			try {
				return br.readLine();
			} catch (Exception e) {
				e.printStackTrace();
			}
			return null;
		}

		public boolean hasNext() {
			String next = null;
			try {
				next = br.readLine();
			} catch (Exception e) {
			}
			if (next == null) {
				return false;
			}
			st = new StringTokenizer(next);
			return true;
		}
	}

	// EFFICIENT SORTING Ascending
	static void ruffleSortAsc(int[] l) {
		int n = l.length; // shuffle, then sort
		for (int i = 0; i < n; i++) {
			int oi = random.nextInt(n), temp = l[oi];
			l[oi] = l[i];
			l[i] = temp;
		}
		Arrays.sort(l);
	}

	// EFFICIENT SORTING Descending
	static void ruffleSortDesc(Integer[] a) {
		int n = a.length; // shuffle, then sort
		for (int i = 0; i < n; i++) {
			int oi = random.nextInt(n), temp = a[oi];
			a[oi] = a[i];
			a[i] = temp;
		}
		Arrays.sort(a, Collections.reverseOrder());
	}

	// Array Sum
	static long sum(Integer[] arr) {
		long sum = 0;
		for (int i : arr)
			sum += i;
		return sum;
	}

	// swap array elements
	static void swap(int arr1[], int arr2[], int i, int j) {
		int temp = arr1[i];
		arr1[i] = arr2[j];
		arr2[j] = temp;
	}

	// reading array value;
	static void read(int[] num) {
		for (int i = 0; i < num.length; i++)
			num[i] = sc.nextInt();
		return;
	}

//    reading arraylistValue

	// check for even odd
	static boolean isEven(int n) {
		return ((n & 1) != 1);
	}

	// max in a array
	static int max(Integer[] arr) {
		int max = Integer.MIN_VALUE;
		for (int i = 0; i < arr.length; i++)
			if (max < arr[i])
				max = arr[i];
		return max;
	}

	// print array
	static void printarr(Integer arr[]) {
		for (int i : arr)
			System.out.println(i);
	}

	// ceil of two elements
	static long ceil(int a, int b) {
		return (long) Math.ceil(((double) a / (double) b));
	}

	// floor of two elements
	static long floor(int a, int b) {
		return (long) Math.floor(((double) a / (double) b));
	}

}